<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri","sans-serif";}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Hello Logback-User support,<o:p></o:p></p>
<p class="MsoNormal">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”.
<o:p></o:p></p>
<p class="MsoNormal">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.<o:p></o:p></p>
<p class="MsoNormal">Logback version : 1.0.13<o:p></o:p></p>
<p class="MsoNormal"><span style="font-size:14.0pt"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:14.0pt">Logback configuration<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""><appender name="LogFile" class="ch.qos.logback.classic.sift.<span style="background:yellow;mso-highlight:yellow">SiftingAppender</span>"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">     <discriminator><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">           <key><span style="background:yellow;mso-highlight:yellow">application-name</span></key><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">           <defaultValue>5</defaultValue><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">     </discriminator><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">     <sift><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">         <appender name="${application-name}" class="ch.qos.logback.core.rolling.RollingFileAppender"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">               <prudent>false</prudent><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">                <file>C:/logs<span style="background:yellow;mso-highlight:yellow">/${application-name}.</span>log</file><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">                <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">                           <!-- daily rollover --><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">                           <fileNamePattern>c:/logs/${application-name}.%d{yyyy-MM-dd}.%i.log</fileNamePattern><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">                           <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">                                <maxFileSize>5MB</maxFileSize><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">                           </timeBasedFileNamingAndTriggeringPolicy><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">                           <!--<triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">                             <maxFileSize>5MB</maxFileSize><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">                           </triggeringPolicy>--><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">                           <MaxHistory>30</MaxHistory><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">                     </rollingPolicy><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">                     <encoder><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">                           <pattern><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">                                <Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger - %msg%n</Pattern><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">                           </pattern><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">                     </encoder><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">            </appender><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">     </sift><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""></appender><o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span style="font-size:14.0pt">Logback Loading programmatically from the Context Listener class<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory();<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">JoranConfigurator jc = new JoranConfigurator();<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">jc.setContext(context);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">context.reset(); <o:p>
</o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New";background:yellow;mso-highlight:yellow">context.putProperty("application-name", sce.getServletContext().getServletContextName());</span><span style="font-family:"Courier New""><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">String logFilePath = sce.getServletContext().getInitParameter(INIT_PARAM_NAME);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">if (logFilePath==null){<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:.5in"><span style="font-family:"Courier New"">throw new RuntimeException("Unable to load init parameter " + INIT_PARAM_NAME + " from web.xml file");<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">}<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">try{<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:.5in"><span style="font-family:"Courier New"">jc.doConfigure(logFilePath);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">} catch (Exception e){<o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:.5in"><span style="font-family:"Courier New"">e.printStackTrace();<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">     throw new RuntimeException("Unable to load logback.xml file successfully @ " + logFilePath, e);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">}<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""><o:p> </o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Is this a known issue? Is there a fix for this already? Please advise.<o:p></o:p></p>
<p class="MsoNormal">Appreciate!<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Regards,<o:p></o:p></p>
<p class="MsoNormal">Sagar Shah<o:p></o:p></p>
</div>
<!doctype html>
<title>Untitled Document</title>
<link href="http://fonts.googleapis.com/css?family=Merriweather+Sans" rel="stylesheet" type="text/css"><style>
@import url(http://fonts.googleapis.com/css?family=Merriweather+Sans:700,400,300,300italic);
p {font-family: 'Merriweather Sans', Helvetica, Arial, sans-serif; font-weight: 300; color:#555; font-size:11px;}
.bluetext {color:#003CA6}
</style>
<table border="0" cellspacing="0" cellpadding="0" width="610">
<tbody>
<tr>
<td>
<p><span style="font-size:13px"><br>
<b>Sagar Shah </b></span><br>
Contractor<br>
<img src="http://community.medhost.com/SiteCollectionImages/MEDHOST-logo.png" width="200" height="45" alt="MEDHOST logo"><br>
6550 Carothers Pkwy STE 100 Franklin, TN 37067<br>
<span class="bluetext">p. </span><span class="bluetext">c. </span><span class="bluetext">f.
</span><br>
<a href="mailto:Sagar.Shah@medhost.com" class="bluetext">Sagar.Shah@medhost.com</a>
<br>
<br>
</p>
<p><b><span style="color:#003CA6; line-height:11px; font-family: 'Merriweather Sans', 'Helvetica Neue', Helvetica, Arial, sans-serif">Register for the 2015 MEDHOST MPACT Summit held September 14-18, 2015 in Nashville, Tennessee.</span></b></p>
<br>
<br>
<p></p>
<p><span style="font-size:10px; color:#999; line-height:11px;  font-family:" MerriweatherSans?,Helvetica,Arial,sans-serif?="">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.</span></p>
</td>
</tr>
</tbody>
</table>
</body>
</html>