[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


Hi,

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:

 <env-entry>
        <env-entry-name>logback/context-name</env-entry-name>
        <env-entry-type>java.lang.String</env-entry-type>
        <env-entry-value>app1-web</env-entry-value>
</env-entry>


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:

<configuration>

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

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

</configuration>


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!
Stephan
-- 
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