Re: [logback-user] logback initialization "à la" Spring

Davide Baroncelli baroncelli at
Fri Sep 28 11:37:15 CEST 2007

Joern Huxhorn wrote:
> Hi Davide.
> It's possible to change the logging configuration at runtime with code 
> like this:
>         ILoggerFactory loggerFactory = LoggerFactory.getILoggerFactory();

Hi, thank you very much for your help: I finally managed to write something
very similar to what's in Spring. You can find it here ( here ) in case
someone should be interested. I finally resorted to using 
ContextInitializer.configureByResource( loggerContext, url );
which spares some lines of code.

Joern Huxhorn wrote:
> I've never used  Log4jConfigListener myself so I don't know how it works 
> but doesn't the configuration of the logging environment during normal 
> spring-initializations mean that at least some spring-log-events are 
> swallowed? If this is not the case then everything should be fine.

No, it does not because this is "in Spring" but only from a library
perspective (i.e. you don't need a running application context in order to
use it): it gets configured as a listener or a servlet with init order = 0,
so it is initialized before anything else. The log4jconfiglistener and
servlet in Spring allow configuring also the auto-reload (turn it on-off and
reloading time): since there is no autoreload in logback I stripped this out
of my listener.

View this message in context:
Sent from the Logback User mailing list archive at

More information about the Logback-user mailing list