I have a small requirement where the default log level is info, but if the user wants to invoke the Java program with debug level, the Debug should start off. I am trying to achieve this using this code..
When I do this, the debug statement at the end does not print. Then I thought may be the root logger level is not propagated after the initialization at start up, so I tried this
The info statement prints "this is info" then the next info statement prints "log level is DEBUG" the next statement prints true but the intermediate debug statement does not print.
I have done this before in a Web app and it works just fine. I do not understand what is going on. Can someone please help me understand this.
SCJP 1.4, SCWCD 1.4, SCBCD 1.3, OCA (DBA)<br /> <br />Winners dont do different things. They do things differently...
Where (i.e. in which "appender") does it not print? On the CONSOLE or in some file? Check the value of "Threshold" attribute for the appender in which you expect this message to be logged. Maybe the Threshold value is set to INFO, because of which the debug statements are ignored in that appender.
@Paul: I dont have custom settings for each logger based on package or class structure, so the root logger settings take effect in each, but when I update the root logger that doesn't get updated in the current loggers.
@Jaikiran: The idea is to give the user the ability to debug at command line before launching the program. The threshold is info but I want to be able to selectively change it to debug at runtime..