log4j doesn’t refresh Loglevels correctly

I don’t know whether it is a log4j (JBoss 1.2.14) problem or a bug in the Jboss Log4jService URLWatchTimerTask (from JBoss 4.3.0.GA) which i use on my server to refresh the log4j configuration automatically after a change. When I try to  set a higher log level by a base package name, it doesn’t work if formerly a lower log level was set explicit for a class.

Here is an example:

First my machine is configured like this (snip of log4j.xml):

<!-- limit my code-->
<category name="de.koelnerwasser">
 <priority value="INFO" />
</category>
<!-- log a class explicit -->
<category name="de.koelnerwasser.testclass">
 <priority value="DEBUG" />
</category>

Until now everything is fine – all info messages and the debug messages of testclass are logged.  When i change the log4j.xml like this:

<!-- limit my code-->
<category name="de.koelnerwasser">
 <priority value="ERROR" />
</category>

.. and deploy the file to my server, the log4j framework will be reconfigured by the URLWatchTimerTask.

Now only error will be logged and – this is curious: Debug Messages of my testclass . The old loglevel DEBUG will not be overwritten by the ERROR level.  I think this is a little bug of log4j or the Jboss URLWatchTimerTask, i will analyse the code and add a defect to Jboss or Apache.

Leave a Reply

Your email address will not be published. Required fields are marked *

*