[logback-user] Problems with jaino evaluator

George, Kenneth V [NTK] Kenneth.V.George at sprint.com
Wed Jun 20 19:34:25 CEST 2012

Good afternoon.

I have a situation where I need to log information to 2 separate files, but under different conditions, for the same context/class files.

Basically, I have 2 files: 1 log, 1 alarm_log.

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.

Can this even be done (maybe I am just using it wrong)?  Here is the section of my logback.xml file specifying the appender:

    <appender name="ALARM" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
                    if (mdc == null || mdc.get("SEND_ALARM") == null)
                        return false;

                     return true;
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!-- daily rollover -->

            <!-- keep 30 days' worth of history -->

            <pattern>%date{MMM dd, yyyy hh:mm:ss} %-5level %msg%n</pattern>



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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/logback-user/attachments/20120620/e52c7751/attachment.html>

More information about the Logback-user mailing list