
Hi, i would like to watch the 'internal' logging of logback to check whether logback is happy with the provided logback.xml (similar to using the log4j.debug in log4j), but i am not sure how to do this. i noticed the existence of StatusManager, but it's not clear to me how to use it. thanks for any guidance on this, dirk

Hi Dirk, Sorry for the late reply. I believe that logback's internal status reporting is one of its strong points. Basically, all logback modules (logback-core, logback-classic and logback-access) revolve around a context, a LoggerContext in case of logback-classic. All problems encountered during the lifetime of the context are reported through status messages which are added to a StatusManager. Each context has its own separate StatusManager. Thus, whenever you wish to print the internal status of a context, you call StatusPrinter.print(context). In logback-classic, the exact steps would be LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory(); StatusPrinter.print(lc); For more complete examples see "Chapter 2 - Architecture" [1] section entitled "Configuration" and especially the MyAppWithConfigFile class [2]. I hope this helps, [1] http://logback.qos.ch/manual/architecture.html [2] http://logback.qos.ch/xref/chapter2/MyAppWithConfigFile.html dirk ooms wrote:
Hi,
i would like to watch the 'internal' logging of logback to check whether logback is happy with the provided logback.xml (similar to using the log4j.debug in log4j), but i am not sure how to do this. i noticed the existence of StatusManager, but it's not clear to me how to use it.
thanks for any guidance on this, dirk
-- Ceki Gülcü Logback: The reliable, generic, fast and flexible logging framework for Java. http://logback.qos.ch
participants (2)
-
Ceki Gulcu
-
dirk ooms