[logback-user] logback.xml scan & reload issue when using context properties

Sagar Shah Sagar.Shah at medhost.com
Tue Dec 2 22:10:19 CET 2014

Hello Logback-User support,
I am using common logback.xml file, which is loaded programmatically from different J2EE web applications and which writes to different log files using "SiftingAppender".
Everything works fine unless logback.xml file has been modified. Once it has been modified, it gets scanned & reloaded as per configuration of scanPeriod, post which it does not recognize the context properties and it still writes all the logs, but in a separate file (with suffix of application-name_IS_UNDEFINED) for al lthe applications.
Logback version : 1.0.13

Logback configuration
<appender name="LogFile" class="ch.qos.logback.classic.sift.SiftingAppender">
         <appender name="${application-name}" class="ch.qos.logback.core.rolling.RollingFileAppender">
                <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
                           <!-- daily rollover -->
                           <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                           <!--<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
                                <Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</Pattern>

Logback Loading programmatically from the Context Listener class
LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();
JoranConfigurator jc = new JoranConfigurator();
context.putProperty("application-name", sce.getServletContext().getServletContextName());
String logFilePath = sce.getServletContext().getInitParameter(INIT_PARAM_NAME);
if (logFilePath==null){
throw new RuntimeException("Unable to load init parameter " + INIT_PARAM_NAME + " from web.xml file");
} catch (Exception e){
     throw new RuntimeException("Unable to load logback.xml file successfully @ " + logFilePath, e);

Is this a known issue? Is there a fix for this already? Please advise.

Sagar Shah

Sagar Shah
[MEDHOST logo]
6550 Carothers Pkwy STE 100 Franklin, TN 37067
p. c. f.
Sagar.Shah at medhost.com<mailto:Sagar.Shah at medhost.com>

Register for the 2015 MEDHOST MPACT Summit held September 14-18, 2015 in Nashville, Tennessee.

CONFIDENTIALITY STATEMENT: The documents accompanying this transmission may contain confidential and/or legally privileged health or other information. This information is intended only for the use of the individual or entity named above. The authorized recipient of this information is prohibited from disclosing this information to any other party unless required to do so by law or regulation and is required to destroy the information after its stated need has been fulfilled. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or action taken in reliance on the contents of these documents is strictly prohibited. If you have received this information in error, please notify the sender immediately and arrange for the return or destruction of these documents.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20141202/044f8ab8/attachment.html>

More information about the Logback-user mailing list