[logback-user] Logback defaulting to debug mode for some third party libraries

David Roussel nabble at diroussel.xsmail.com
Tue Jul 16 15:57:00 CEST 2013


Run it in a debugger, set a breakpoint in the hibernate class in question and step through the JNDI lookup code. 

David

On 16 Jul 2013, at 12:59, amit shah <amits.84 at gmail.com> wrote:

> On troubleshooting further I released that hibernate and apache client libraries use the default logger context created during the initialization time. This logger context has the root log level set to DEBUG. 
> We use JNDI as the context selector.
> 
> It is strange that the context name is not found at runtime when the ConnectionManager class (hibernate class - org.hibernate.jdbc.ConnectionManager) tries to instantiate a logger. Logger instance creation calls ContextJNDISelector.getLoggerContext() method. This method does a JNDI lookup but does not find the entry.
> 
> I troubleshooted further by spawning a thread in a servlet context listener to print the JNDI entry (java:comp/env/logback/context-name) every 3 seconds. The logs from the thread indicate that the JNDI entries are always present.
> 
> Any ideas why is contextName is not found in JNDI when queried by ContextJNDISelector?
> 
> 
> 
> On Sat, Jul 13, 2013 at 10:19 AM, amit shah <amits.84 at gmail.com> wrote:
>> We use slf4j and logback for logging in our java ee web application. Recently in order to move these libraries to a common location in the glassfish app server (to glassfish\lib directory specifically) we made a couple of configuration changes. We made changes in the web.xml file to add JNDI entries and renamed the logback.xml to logback-<context-name>.xml as specified in here. The logback-<context-name>.xml is placed in WEB-INF\classes directory.
>> 
>> After this change, logging for hibernate and http-client libraries is defaulting to debug mode and hence there is lot of logging being done. The root logger has INFO log level and there are no specific loggers defined for hibernate & http-client libraries.
>> 
>> If I revert this change i.e. remove the jndi entry in web.xml and rename the configuration file to logback.xml, only INFO logs are logged as expected.
>> 
>> Any suggestions on what could be the issue?
>> 
>> Thanks,
>> Amit.
>> 
> 
> _______________________________________________
> 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/20130716/214d7fc5/attachment.html>


More information about the Logback-user mailing list