[logback-user] Enable Debugging Mode Programmatically?

BAKHTI Mohammed onlymed at hotmail.com
Tue Dec 13 22:20:34 CET 2011


Hello Andrew, 

For the root level you can do something like this : 

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


> From: andrew.bourgeois at hotmail.com
> To: logback-user at qos.ch
> 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: logback-user at qos.ch
> 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
> Logback-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user 
> 
> _______________________________________________
> Logback-user mailing list
> Logback-user at qos.ch
> http://mailman.qos.ch/mailman/listinfo/logback-user
 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20111213/53043dac/attachment.html>


More information about the Logback-user mailing list