hypfvieh / dbus-java

Improved version of java DBus library provided by freedesktop.org (https://dbus.freedesktop.org/doc/dbus-java/)
https://hypfvieh.github.io/dbus-java/
MIT License
185 stars 73 forks source link

Is there a way to disable logging? #144

Closed weliem closed 3 years ago

weliem commented 3 years ago

Hi,

I am using slf4j throughout my application and when I put the log level to DEBUG, there is a massive amount of log items coming from this library.

It would be handy if I could switch of logging for this library only so I can only see my app's log items.

Is it possible?

hypfvieh commented 3 years ago

This can be done by configuring your logging backend. If you use logback, you can add this to your logback.xml:

<logger name="org.freedesktop.dbus"                             level="INFO" />

If you use log4j2, you have to add this to the Section:

<Logger name="org.freedesktop.dbus"                             level="INFO" />

In both cases, logging of dbus-java would only be visible if it is logged on level INFO or higher.

weliem commented 3 years ago

I don't want to put the log to INFO because then I don't see the other DEBUG logging from my application anymore. There are many other components in my application that do logging.

So what I meant was that I want to turn off logging only for the library while the rest of my application can still log on DEBUG level.

hypfvieh commented 3 years ago

This is what I told you. The settings given above will set the log level to INFO for all Loggers starting with 'org.freedesktop.dbus' - so every logger used in dbus-java will only log INFO or above. It will not change anything related to YOUR loggers as long as your loggers are not in org.freedesktop.dbus package or start with that name.

weliem commented 3 years ago

Works! I just misunderstood your first answer...

Thank you . Closing issue