logging-log4j-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Stauffer" <stauffer.ja...@gmail.com>
Subject Re: Programmatic threshold change
Date Wed, 12 Jul 2006 17:27:04 GMT
You may want to look into LogWeb
(http://www.codeczar.com/products/logweb/index.html) to see if that
meets your needs or gives you clues.

On 7/12/06, Sharma, Siddharth <Siddharth.Sharma@staples.com> wrote:
> Greetings
>
> In log4j.xml, we have set the threshold to be 'INFO'.
> We have written a servlet that takes the log level as a parameter and
> dynamically changes log4j's log level.
> This is to facilitate bumping the log level up on-demand when an exception
> occurs to capture more information.
>
> Here is the code:
> LoggerRepository logRepository = LogManager.getLoggerRepository();
> logRepository.setThreshold(someLogLevel);
>
>
> But I find that the log4j does not get configured at runtime to log at a
> level lower than what is defined in log4j.xml.
> In other words, I can successfully change to WARN, ERROR or FATAL and then
> back down to INFO, but I cannot change it to DEBUG (since log4j.xml has
> INFO).
>
> I am hoping this is possible to do and will appreciate the code that will
> achieve this.
> I can certainly change log4j.xml to have a threshold of DEBUG and then
> programmatically change it to INFO during server startup. But I'd rather not
> do it that way since it is a HACK!
>
> Thanks in advance
> Sid
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
> For additional commands, e-mail: log4j-user-help@logging.apache.org
>
>


-- 
James Stauffer
Are you good? Take the test at http://www.livingwaters.com/good/

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-user-unsubscribe@logging.apache.org
For additional commands, e-mail: log4j-user-help@logging.apache.org


Mime
View raw message