[logback-user] SiftingAppender lose dynamic configuration in Web application in EAR

Béziat wahav at yahoo.fr
Thu Aug 22 18:09:04 CEST 2013


Hello,


For a project I am using a SiftingAppender on top of a RollingFileAppender defined in a logback.xml.

<appender name="SIFT" class="ch.qos.logback.classic.sift.SiftingAppender">
        <discriminator class="ch.qos.logback.classic.sift.JNDIBasedContextDiscriminator">
            ...
        </discriminator>
        <sift>
            <appender name="FILE-${contextName}" class="ch.qos.logback.core.rolling.RollingFileAppender">
                <file>logs/${contextName}.log</file>
    ...


The logback configuration is shared in an EAR for multiple web applications.
I update the RollingFileAppender file value at deployment in a ServletContextListener, 

replacing the ${contextName} with the context-root of the application being deployed.


For instance, Web Application MyWebApp1, configured to log to logs/mywebapp1.log is deployed to /ContextA/MyWebApp1. 

So Iupdate logs/mywebapp1.log to logs/contexta_mywebapp1.log.

It should be just the ServletContextListener logging to the initial file.


My issue is that it occurs that the application /ContextA/MyWebApp1 switch back to logs/mywebapp1.log.
It seems the programmatic configuration I did at deployment is lost.

My question is, finally :), is there a way for logback to detect configuration loss and launch programmatic reconfiguration ?

Thanks,

David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20130822/f1274ac4/attachment.html>


More information about the Logback-user mailing list