[logback-user] Logger context for EJBs in .ear file?

Stephan Vollmer-2 vollmer.stephan at googlemail.com
Sun Sep 11 18:16:16 CEST 2011


how can I set the logger context in an .ear file that is deployed to a
GlassFish 3.1.1 application server? What I want to achive is that each
application has a separate logfile.

I've read Chapter 9 and tried this successfully with a war archive with this
entry in the WEB-INF/web.xml file:


But when I add the same entry to the application.xml of the ear file,
Logback does not find the JNDI entry.

My logback.xml is:


    <jmxconfigurator />
    <insertFromJNDI env-entry-name="logback/context-name" as="appName" />

    <appender class="ch.qos.logback.core.ConsoleAppender" name="CONSOLE">
            <pattern>%-5level ctx: ${CONTEXT_NAME} %d{HH:mm:ss.SSS}
[%thread] %logger - %msg</pattern>
    <root level="TRACE">
        <appender-ref ref="CONSOLE" />


I believe that Logback cannot find the JNDI entry because it is looking for
"java:comp/env/logback/context-name" but the entries in application.xml
refer to "java:app/env"?

How can I solve this problem? Or is there a different way to enable logging
separation for ear applications?

Thanks for your help!
View this message in context: http://old.nabble.com/Logger-context-for-EJBs-in-.ear-file--tp32442683p32442683.html
Sent from the Logback User mailing list archive at Nabble.com.

More information about the Logback-user mailing list