[logback-user] question reg. reading JNDI env entries

Ravikanth Gangarapu rgangarapu at fry.com
Mon Jun 6 22:25:34 CEST 2011


Hi,
     I am using logback-classic (0.9.28) for a web application running on tomcat 5.5.
I am trying to read the JNDI env entry values using the <insertFromJNDI env-entry-name="java:comp/env/stderr-logging" as="stdErrLogging" /> tag in the logback.xml file.
I have lots of env entry values that can be read from META-INF/context.xml file. For this specific example, my context.xml file has this.
<context>
....
<Environment name="stderr-logging" type="java.lang.String" value="true"/>
....
But, this insertFromJNDI tags always says the entry value is null or empty. However, Once I am in a servlet code, new InitialContext().lookup("java:comp/env/stderr-logging") retrieves the correct value from context xml file.

I looked in the JNDIUtil class from ch.qos.logback.classic.util package and the code throws error saying "javax.naming.NameNotFoundException: Name java:comp is not bound in this Context".

Would somebody know how to read the environment entry values from the META-INF/context.xml file ?

Thanks for help
Ravi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://qos.ch/pipermail/logback-user/attachments/20110606/d008dcb1/attachment.html>


More information about the Logback-user mailing list