Hello Andrew, 

For the root level you can do something like this : 

((Logger) 
LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME)).setLevel(Level.toLevel("DEBUG"));


> From: [email protected]
> To: [email protected]
> Date: Tue, 13 Dec 2011 21:42:25 +0100
> Subject: Re: [logback-user] Enable Debugging Mode Programmatically?
> 
> Hello Jack
> 
> I don't know how to do it for the rootLogger, but here's how I did enable a 
> debug level for my whole app:
> LoggerContext lc = (LoggerContext) LoggerFactory.getILoggerFactory();
> lc.getLogger("be.mydomain.testapp").setLevel(Level.DEBUG);
> 
> Using the following imports:
> import org.slf4j.LoggerFactory;
> import ch.qos.logback.classic.Level;
> import ch.qos.logback.classic.LoggerContext;
> 
> If anyone knows how to do it for the rootLogger, please let me know (as it 
> can be annoying to enable debug logs for every package of the 
> dependencies...).
> 
> Best regards
> 
> Andrew
> 
> -----Original Message----- 
> From: juminoz
> Sent: Tuesday, December 13, 2011 12:14 AM
> To: [email protected]
> Subject: [logback-user] Enable Debugging Mode Programmatically?
> 
> 
> I was wondering if there is a way to enable debug mode programmatically.
> Since I'm not allowed to use configuration file, I'm currently configure
> everything programmatically. Recently, I ran into an issue where
> RollingFileAppender stop writing to file though FileAppender works perfectly
> fine. In fact, RollingFileAppender was also working last week and nothing
> that I'm aware of has changed since.
> 
> Please let me know if there is a way to enable debug since doing it using
> configuration file (logback.xml) doesn't seem to be working.
> 
> Thanks,
> Jack
> -- 
> View this message in context: 
> http://old.nabble.com/Enable-Debugging-Mode-Programmatically--tp32961424p32961424.html
> Sent from the Logback User mailing list archive at Nabble.com.
> 
> _______________________________________________
> Logback-user mailing list
> [email protected]
> http://mailman.qos.ch/mailman/listinfo/logback-user 
> 
> _______________________________________________
> Logback-user mailing list
> [email protected]
> http://mailman.qos.ch/mailman/listinfo/logback-user
                                          
_______________________________________________
Logback-user mailing list
[email protected]
http://mailman.qos.ch/mailman/listinfo/logback-user

Reply via email to