Reduse logging

180 views
Skip to first unread message

Jaco

unread,
Jul 26, 2015, 3:32:37 PM7/26/15
to openhab
Hello,

I've installed the 'modbus binding'. Everything works fine but I have the following question:
Every time data is read from the Modbus device, this is written in the logging. It doesn't matter if the data is changed or if it stays the same. I left the polling option to the default value of 200, so a real lot of 'useless' information is written into the logging.

Does anybody knows if it's possible to disable the logging, or at least stop the 'informational' logging of the Modbus binding?

Thanks in advance,

Jaco

Nathan Stratton

unread,
Jul 27, 2015, 1:56:12 PM7/27/15
to ope...@googlegroups.com
I hired a developer to fix this for me, it turns out its only a few lines of code:


I have hundreds of modbus lines so yes, it was quite annoying.


><>
nathan stratton | vp technology | broadsoft, inc | +1-240-404-6580 | www.broadsoft.com

--
You received this message because you are subscribed to the Google Groups "openhab" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openhab+u...@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
Visit this group at http://groups.google.com/group/openhab.
To view this discussion on the web visit https://groups.google.com/d/msgid/openhab/64b89f10-f709-421b-8842-dd88a68f9c1d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Marcel Erkel

unread,
Jul 27, 2015, 4:34:39 PM7/27/15
to openhab, nat...@robotics.net
Hi,

You can disable the logging for the modbus binding using the logback.xml file in the openHAB configurations directory. Look for the following section:

        <logger name="runtime.busevents" level="INFO" additivity="false">
               
<appender-ref ref="EVENTFILE" />
               
<appender-ref ref="STDOUT" />
       
</logger>

       
<logger name="org.openhab" level="INFO"/>

and add below this section the following:

        <logger name="net.wimpi.modbus" level="OFF"/>
       
<logger name="org.openhab.binding.modbus" level="OFF"/>

If you still want to log entries at warning or error level, then change OFF to WARN or ERROR respectively. You can also do this at the individual class level so that some classes log at info level, others only at warning level, or at debug level if you want more logging instead.

No need to hire a developer or mess with the source code yourself.

Cheers,
Marcel

Jaco

unread,
Jul 29, 2015, 3:25:01 PM7/29/15
to ope...@googlegroups.com, nat...@robotics.net, marcel...@gmail.com
Hello Marcel,

First of all thanks for your response....

I added the lines like this:

......

<logger name="runtime.busevents" level="INFO" additivity="false">
    <appender-ref ref="EVENTFILE" />
    <appender-ref ref="STDOUT" />
</logger>
<logger name="net.wimpi.modbus" level="OFF"/>
<logger name="org.openhab.binding.modbus" level="OFF"/>
 
<logger name="org.openhab" level="INFO"/>
......

But unfortunately it doesn't make any difference, I still see as much logging as before:

2015-07-29 21:22:04 - Shutter_GF_Living_FrontWindow_down state updated to OFF
2015-07-29 21:22:05 - Shutter_GF_Living_FrontWindow_up state updated to OFF
2015-07-29 21:22:05 - Shutter_GF_Living_FrontWindow_down state updated to OFF
2015-07-29 21:22:06 - Shutter_GF_Living_FrontWindow_up state updated to OFF
2015-07-29 21:22:06 - Shutter_GF_Living_FrontWindow_down state updated to OFF
2015-07-29 21:22:07 - Shutter_GF_Living_FrontWindow_up state updated to OFF
2015-07-29 21:22:07 - Shutter_GF_Living_FrontWindow_down state updated to OFF
2015-07-29 21:22:08 - Shutter_GF_Living_FrontWindow_up state updated to OFF
2015-07-29 21:22:08 - Shutter_GF_Living_FrontWindow_down state updated to OFF
2015-07-29 21:22:09 - Shutter_GF_Living_FrontWindow_up state updated to OFF
2015-07-29 21:22:09 - Shutter_GF_Living_FrontWindow_down state updated to OFF
2015-07-29 21:22:10 - Shutter_GF_Living_FrontWindow_up state updated to OFF
2015-07-29 21:22:10 - Shutter_GF_Living_FrontWindow_down state updated to OFF
2015-07-29 21:22:11 - Shutter_GF_Living_FrontWindow_up state updated to OFF
2015-07-29 21:22:11 - Shutter_GF_Living_FrontWindow_down state updated to OFF
2015-07-29 21:22:12 - Shutter_GF_Living_FrontWindow_up state updated to OFF
2015-07-29 21:22:12 - Shutter_GF_Living_FrontWindow_down state updated to OFF
2015-07-29 21:22:13 - Shutter_GF_Living_FrontWindow_up state updated to OFF
2015-07-29 21:22:13 - Shutter_GF_Living_FrontWindow_down state updated to OFF
2015-07-29 21:22:14 - Shutter_GF_Living_FrontWindow_up state updated to OFF
2015-07-29 21:22:14 - Shutter_GF_Living_FrontWindow_down state updated to OFF
2015-07-29 21:22:15 - Shutter_GF_Living_FrontWindow_up state updated to OFF
2015-07-29 21:22:15 - Shutter_GF_Living_FrontWindow_down state updated to OFF
2015-07-29 21:22:16 - Shutter_GF_Living_FrontWindow_up state updated to OFF
2015-07-29 21:22:16 - Shutter_GF_Living_FrontWindow_down state updated to OFF
2015-07-29 21:22:17 - Shutter_GF_Living_FrontWindow_up state updated to OFF
2015-07-29 21:22:17 - Shutter_GF_Living_FrontWindow_down state updated to OFF
2015-07-29 21:22:18 - Shutter_GF_Living_FrontWindow_up state updated to OFF
2015-07-29 21:22:18 - Shutter_GF_Living_FrontWindow_down state updated to OFF


Did I do something wrong?

Jaco

Jaco

unread,
Jul 29, 2015, 3:29:20 PM7/29/15
to openhab, nat...@robotics.net
Hello Nathan,

I want to thank you also for the reply..... 

I'm quite new in the openHAB/GitHub-scene and I don't know exactly what to do with the link you've sent.

Can I download a new binding-file or can I punt the code into my actual binding-file?

With kind regards,

Jaco 

Nathan Stratton

unread,
Jul 29, 2015, 3:48:45 PM7/29/15
to Marcel Erkel, openhab
On Mon, Jul 27, 2015 at 4:34 PM, Marcel Erkel <marcel...@gmail.com> wrote:
Hi,

You can disable the logging for the modbus binding using the logback.xml file in the openHAB configurations directory. Look for the following section:

        <logger name="runtime.busevents" level="INFO" additivity="false">
               
<appender-ref ref="EVENTFILE" />
               
<appender-ref ref="STDOUT" />
       
</logger>

       
<logger name="org.openhab" level="INFO"/>

and add below this section the following:

        <logger name="net.wimpi.modbus" level="OFF"/>
       
<logger name="org.openhab.binding.modbus" level="OFF"/>

If you still want to log entries at warning or error level, then change OFF to WARN or ERROR respectively. You can also do this at the individual class level so that some classes log at info level, others only at warning level, or at debug level if you want more logging instead.

No need to hire a developer or mess with the source code yourself.

Right, but I did not want to turn off logs, I just wanted it to log on state change. Having a log say OPEN, OPEN, OPEN, every 200 ms is crazy, but disabling logs so you don't get any state info in logs seamed just as crazy to me. So I had the binding modified so it only logs on state change.

-Nathan 

Nathan Stratton

unread,
Jul 29, 2015, 3:52:42 PM7/29/15
to Jaco, openhab
Sure, I just put the binding up on my web server.


-Nathan 

Marcel Erkel

unread,
Jul 31, 2015, 4:33:42 PM7/31/15
to openhab, jacovand...@gmail.com, nat...@robotics.net
Hi Jaco,

No you didn't do anything wrong. The problem with the event.log is that it's not the binding that logs to that file. Hence the:

<logger name="net.wimpi.modbus" level="OFF"/>
<logger name="org.openhab.binding.modbus" level="OFF"/>


have no effect.

I've been looking in to logback filters but it seems openHAB does not ship with the require jar files to make that work.
You could try adding:

<turboFilter class="ch.qos.logback.classic.turbo.DuplicateMessageFilter"/>

I don't have that many duplicates so I'm not sure if it works or not, but it may be worth a shot.

Cheers,
Marcel

Nick AtNick

unread,
Sep 16, 2015, 6:24:46 AM9/16/15
to openhab


On Monday, 27 July 2015 19:56:12 UTC+2, Nathan Stratton wrote:
I hired a developer to fix this for me

Hi Nathan,
can you recommend your developer? Because some folks here are looking for one.

E.g.:
https://groups.google.com/d/msg/openhab/vC4e9ySWWJY/g7Kyn39FmL4J
https://groups.google.com/d/msg/openhab/cKSF4YPyBec/Btzihvs371oJ
Reply all
Reply to author
Forward
0 new messages