<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style>
<!--
@font-face
{font-family:Calibri}
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri","sans-serif"}
a:link, span.MsoHyperlink
{color:blue;
text-decoration:underline}
a:visited, span.MsoHyperlinkFollowed
{color:purple;
text-decoration:underline}
span.EmailStyle17
{font-family:"Calibri","sans-serif";
color:windowtext}
.MsoChpDefault
{font-family:"Calibri","sans-serif"}
@page WordSection1
{margin:1.0in 1.0in 1.0in 1.0in}
div.WordSection1
{}
-->
</style>
</head>
<body lang="EN-US" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal">Good afternoon.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">I have a situation where I need to log information to 2 separate files, but under different conditions, for the same context/class files.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Basically, I have 2 files: 1 log, 1 alarm_log.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">I need to set the level for reporting to INFO, but only log WARN/ERROR messages to alarm_log when a MDC value of “SEND_ALARM” is set. I have tried to place a <filter> of type “ch.qos.logback.core.filter.EvaluatorFilter” and cannot seem
to get it to work, messages of Level INFO show-up in the alarm_log.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Can this even be done (maybe I am just using it wrong)? Here is the section of my logback.xml file specifying the appender:</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><span style="font-family:"Courier New""> <appender name="ALARM" class="ch.qos.logback.core.rolling.RollingFileAppender"></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> <filter class="ch.qos.logback.core.filter.EvaluatorFilter"></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> <evaluator></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> <expression></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> if (mdc == null || mdc.get("SEND_ALARM") == null)</span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> return false;</span></p>
<p class="MsoNormal"><span style="font-family:"Courier New"">
</span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> return true;</span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> </expression></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> </evaluator></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> </filter></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> <file>logs/alarms.log</file></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> <!-- daily rollover -->
</span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> <fileNamePattern>logs/archive/logFile.%d{yyyy-MM-dd}.log</fileNamePattern></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> </span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> <!-- keep 30 days' worth of history -->
</span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> <maxHistory>30</maxHistory></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> </rollingPolicy></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> </span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> <encoder></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> <pattern>%date{MMM dd, yyyy hh:mm:ss} %-5level %msg%n</pattern></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> </encoder></span></p>
<p class="MsoNormal"><span style="font-family:"Courier New""> </appender></span></p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">Thanks.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> </p>
</div>
<br>
<hr>
<font face="Arial" color="Gray" size="1"><br>
This e-mail may contain Sprint Nextel proprietary information intended for the sole use of the recipient(s). Any use by others is prohibited. If you are not the intended recipient, please contact the sender and delete all copies of the message.<br>
</font>
</body>
</html>