
Hello Skasish, Please install OnConsoleStatusListener which should give clues as to the underlying causes of the problem. See http://logback.qos.ch/manual/configuration.html#statusListener for details. I suspect that the expression given to JaninoEventEvaluator is invalid as lacks return statement for the implicit 'else'. Logback's internal status messages (enabled with OnConsoleStatusListener) are your friend. HTH, -- Ceki On 3/17/2016 11:42, skasish wrote:
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-JaninoEventEvalua... Sent from the Users mailing list archive at Nabble.com. _______________________________________________ logback-user mailing list logback-user@qos.ch http://mailman.qos.ch/mailman/listinfo/logback-user