[slf4j-user] Reconfigure during runtime

Ceki Gülcü ceki at qos.ch
Wed Feb 17 11:56:43 CET 2010


On 17/02/2010 11:46 AM, Per Lindberg wrote:
> Okay, that's nice. Does that mean that if I change the logging level
> to DEBUG at the LOG4J level, then calls to SLF4J log.debug() will
> start to output messages? (I have failed to make that work, but
> perhaps I have just overlooked some small detail...)

Yes, of course. If you change the logging level to DEBUG at the LOG4J
level, then calls to SLF4J log.debug() will start to output messages.

>> If you wish to change logging configuration at runtime, logback has
>> support configuration file reloading which you might find useful:
>>
>> http://logback.qos.ch/manual/configuration.html#autoScan
>
> But I can't modify any files in a running JEE web application.
> (And, besides, logback is not an option for me right now).

If the configuration file lies outside the web-app or if you expand
the war file, you can change the configuration file without changing
or even restarting your web-app. It's an alternative solution, that's
all.

> Can't I just change the logging level by calling log4j
> logger.setLevel(level) ?

Yes, you can.

--
Ceki


More information about the slf4j-user mailing list