Join 34,000+ subscribers and receive articles from our
blog about software quality, testing, QA and security.

[Router] level setting does not work for file connection


#1

I’m playing with the router and like to create a route based on log levels so that only errors and levels above are routed to an error.sil file by the router. The error.sil file is created by the router but no single entry will be written to this file.

Without using a level entry in the connection it works, and everything is written to files based e.g. on app- and hostname.

Is this the expected behavior or am I missing something?

See my test configuration below

<route>
  <triggers>
    <host />
    <application />
  </triggers>
        
  <connections>file(filename="E:\tmp\error.sil", append="true", maxsize="102400", rotate="daily", level="error", backlog.enabled="true", backlog.keepopen="true", async.enabled="true", sync.throttle="false")
  </connections>
</route>

#2

Just for completeness. It’s the same effect by using a simpler configuration by just adding the level to the connection. One file gets entries, the error file stays empty.

<?xml version="1.0" encoding="utf-8" ?>
<router xmlns="http://schemas.gurock.com/smartinspect/router.xsd">
    <logging level="debug" />

    <listeners>
        <!-- <pipe pipename="sirouter" /> -->
        <tcp ip="0.0.0.0" port="4229" />
    </listeners>

    <routes>
        <route>
            <triggers>
                <host />
                <application />
            </triggers>
            <connections>file(filename="E:\tmp\SI\log-%hostname%-%appname%-.sil", maxsize="10MB", maxparts="20", append="true")</connections>
        </route>

        <route>
            <triggers>
                <host />
                <application />
            </triggers>
        
            <connections>file(filename="E:\tmp\SI\error.sil", maxsize="10MB", maxparts="20", append="true", level="error")</connections>
        </route>
    </routes>
</router>

#3

Hello,

Thanks for your posting. The ‘level’ protocol option is a client-side feature only and is not supported by the Router unfortunately. The Router assigns a default level to each packet (e.g. Message) and a level filter of error cannot be triggered. There’s currently no workaround for this other than writing all packets to the log files and using the various property filters (such as the log entry type) in the SmartInspect Console.

Regards,
Tobias


#4

Ok. At least it explains it. But maybe it could be clearer outlined in the docs that not everything is supported. As an improvement you could maybe have a “Limitations” section or something like this in the router docs instead of just pointing to the “Working with SmartInspect -> Connection and Protocols” help section.

Is this something that might be implemented in the router at some stage? I can imagine it could be quite handy for other users as well not being tied to the filtering functionalities exclusively. :slight_smile:


#5

Hello,

Thanks for your reply. The level is currently not part of the storage or transportation protocols so it’s not a limitation by the Router alone and difficult to change. I understand that this may not be obvious and I agree that this should be made clearer in the documentation. Thanks for your suggestion regarding the documentation.

Regards,
Tobias