[
http://jira.qos.ch/browse/LBCORE-118?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11367#action_11367
]
Ceki Gulcu edited comment on LBCORE-118 at 11/10/09 9:12 PM:
-------------------------------------------------------------
When the marker is null, during the evaluation of the boolean expression a
NullPointerException is thrown. This exception is added into the internal list
of status messages. Moreover, since the result of the evaluation is
undetermined (an exception was thrown), neither OnMatch nor OnMismatch
properties apply and the EvaluatorFilter returns NEUTRAL, as it should.
One way to fix this issue, is to modify the evaluator expression to "marker !=
null && marker.getName().equals("Alert")".
I am hesitating to modify JaninoEventEvaluator to inject a dummy marker in case
the logging event's marker is null. This would solve the issue you are facing.
However, there is a downside. Users who would expect to find a null marker will
see a dummy marker and might get confused.
was (Author: [email protected]):
When the marker is null, during the evaluation of the boolean expression a
NullPointerException is thrown. This exception is added into the internal list
of status messages. Moreover, since the result of the evaluation is
undetermined (an exception was thrown), neither OnMatch nor OnMismatch
properties apply and the EvaluatorFilter returns NEUTRAL, as it should.
One way to fix this issue, is to modify the evaluator expression to "marker !=
null && marker.getName().equals("Alert")".
I am hesitating to modify JaninoEventEvaluator to inject a dummy marker in case
the logging event's marker is null. This would solve the issue you are facing.
> EvaluatorFilter returns OnMatch when marker is null
> ---------------------------------------------------
>
> Key: LBCORE-118
> URL: http://jira.qos.ch/browse/LBCORE-118
> Project: logback-core
> Issue Type: Bug
> Components: Other
> Affects Versions: 0.9.17
> Environment: Windows XP
> Reporter: Manuel Kueblboeck
> Assignee: Ceki Gulcu
> Priority: Minor
>
> <appender name="Alert" class="ch.qos.logback.core.ConsoleAppender">
> <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
> <evaluator name="isAlert">
> <expression>marker.getName().equals("Alert")</expression>
> </evaluator>
> <OnMatch>ACCEPT</OnMatch>
> <OnMismatch>DENY</OnMismatch>
> </filter>
> <layout class="ch.qos.logback.classic.PatternLayout">
> <Pattern>ALERT: %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} -
> %msg%n</Pattern>
> </layout>
> </appender>
> In the above example, when an event is logged without an attached marker, the
> filter returns OnMatch. I would expect that it returns OnMismatch.
> A work around for this issue is to change the expression to this:
> <expression>marker != null &&
> marker.getName().equals("Alert")</expression>
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
logback-dev mailing list
[email protected]
http://qos.ch/mailman/listinfo/logback-dev