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