[logback-user] Try to use an evaluator JaninoEventEvaluator in logback. But does not work to filter out depending on condition

skasish asish_sam at hotmail.com
Thu Mar 17 10:42:51 UTC 2016


Try to use an evaluator JaninoEventEvaluator in logback. But does not work to
filter out depending on condition.

My configuration of logback.xml is given below.

<appender name="durgaDlyFileSQL" class="ch.qos.logback.core.FileAppender">
<File>${durga.log.file.name.SQL}</File>
<encoder>
<pattern>${ScreenConversionPattern}</pattern>
</encoder>
<filter class="ch.qos.logback.core.filter.EvaluatorFilter">
<evaluator name="loggingTaskEval"
class="ch.qos.logback.classic.boolex.JaninoEventEvaluator">
<expression>
System.out.println("MDC: " + mdc + " " + mdc.get("screenName")); 
String screen = (String) mdc.get("screenName");

    if ((screen == null) ||
    screen.equals("Server Type Entry/Amend/Cancel")) {
    return false;
    }

</expression>
</evaluator>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${durga.log.file.name.SQL}.%d{${finch.log.file.DefaultRolloverFrequency}}</fileNamePattern>
</rollingPolicy>
</appender>

and the output of the log:

[17 Mar 2016 13:42:18.437][Server Type Entry/Amend/Cancel][durga_admin]
TRACE o.h.type.descriptor.sql.BasicBinder 83 binding parameter [3] as
[VARCHAR] - durga_admin [17 Mar 2016 13:42:18.438][Server Type
Entry/Amend/Cancel][durga_admin] TRACE o.h.type.descriptor.sql.BasicBinder
83 binding parameter [4] as [TIMESTAMP] - 2016-03-17 08:16:23.0 [17 Mar 2016
13:42:18.439][Server Type Entry/Amend/Cancel][durga_admin] TRACE
o.h.type.descriptor.sql.BasicBinder 83 binding parameter [5] as [TIMESTAMP]
- 2016-03-17 08:16:23.0 [17 Mar 2016 13:42:18.440][Server Type
Entry/Amend/Cancel][durga_admin] TRACE o.h.type.descriptor.sql.BasicBinder
83 binding parameter [6] as [VARCHAR] - durga_admin [17 Mar 2016
13:42:18.441][Server Type Entry/Amend/Cancel][durga_admin] TRACE
o.h.type.descriptor.sql.BasicBinder 83 binding parameter [7] as [INTEGER] -
0

I do not want log when screenName = "Server Type Entry/Amend/Cancel"

I'm using janino 2.5.10 and logback 1.1.7 and all the stuff is running on a
tomcat 7.0.47



--
View this message in context: http://logback.10977.n7.nabble.com/Try-to-use-an-evaluator-JaninoEventEvaluator-in-logback-But-does-not-work-to-filter-out-depending-onn-tp14793.html
Sent from the Users mailing list archive at Nabble.com.


More information about the logback-user mailing list