You are viewing a plain text version of this content. The canonical link for it is here.
Posted to log4net-user@logging.apache.org by "Vivek R. Rathod" <vr...@appsecinc.com> on 2010/07/14 23:26:58 UTC

programmatic configuration overrides XmlConfigurator.ConfigureAndWatch ?

Hi, I observed that if I configure log4net using XmlConfigurator.ConfigureAndWatch, and then programmatically change the configuration (change 'root' log level, for example), further changes to the configuration file (like changing the 'root' log level back to the original value) does not cause the log level to revert back to the original value  in the code...
For example, when I call XmlConfigurator.ConfigureAndWatch my 'root' log level is 'DEBUG'. I then change it to 'ERROR' programmtically. But then if I change the log level back to 'DEBUG' in the config file, in my code the 'root' logger still has the log level of 'ERROR'
Is this the intended behavior or am I missing something?
-Vivek

RE: programmatic configuration overrides XmlConfigurator.ConfigureAndWatch ?

Posted by "Vivek R. Rathod" <vr...@appsecinc.com>.
Sorry, may be I posted this too soon, but I do see the log level revert back to the original value - only I cant make it happen consistently. I looked through the source code and noticed that there is a 500 msec delay before the config change is processed. May be thats the reason, but Im not sure. Any confirmation from someone who knows would be very helpful :)
This brings me to another question though - is there a way to stop watching the config file once  XmlConfigurator.ConfigureAndWatch is called, and later resume watching again?
-Vivek
________________________________________
From: Vivek R. Rathod
Sent: Wednesday, July 14, 2010 5:26 PM
To: log4net-user@logging.apache.org
Subject: programmatic configuration overrides XmlConfigurator.ConfigureAndWatch ?

Hi, I observed that if I configure log4net using XmlConfigurator.ConfigureAndWatch, and then programmatically change the configuration (change 'root' log level, for example), further changes to the configuration file (like changing the 'root' log level back to the original value) does not cause the log level to revert back to the original value  in the code...
For example, when I call XmlConfigurator.ConfigureAndWatch my 'root' log level is 'DEBUG'. I then change it to 'ERROR' programmtically. But then if I change the log level back to 'DEBUG' in the config file, in my code the 'root' logger still has the log level of 'ERROR'
Is this the intended behavior or am I missing something?
-Vivek