开发者

How to get Janino to work with logback (method named "contains" is not declared)

开发者 https://www.devze.com 2023-02-07 15:12 出处:网络
I\'m trying to use an evaluator in logback. Therefor I have this snippet in my logback.xml <evaluator name=\"IS_INTERESTING\">

I'm trying to use an evaluator in logback. Therefor I have this snippet in my logback.xml

<evaluator name="IS_INTERESTING">
    <expression>logger != null &amp;&amp; message != null &amp;&amp; logger.contains(".xxx.") &amp;&amp; message.contains("closing session")</expression>
</evaluator>

But Janino isn't able to handle it at it results in this error:

15:56:14,061 |-ERROR in ch.qos.logback.classic.boolex.JaninoEventEvaluator@15da7d - Could not start evaluator with expression [logger != null && message != null && logger.contains(".xxx.") && message.contains("closing session")] org.codehaus.janino.CompileException: Line 2, Column 53: A method named "contains" is not declared in any enclosing class nor any supertype, nor through a static import
    at org.codehaus.janino.CompileException: Line 2, Column 53: A method named "contains" is not declared in any enclosing class nor any supertype, nor开发者_开发百科 through a static import

I thought it might be a version issue with the String class, but replacing 'contains' with calls to 'indexOf' basicly resulted in the same error.

I'm using janino 2.5.16 and logback 0.9.15 and all the stuff is running on a tomcat (started with a maven plugin thingy)

Any ideas what I am doing wrong?


The expression looks good. Version 0.9.15 is almost two years old. Could you please upgrade to the latest logback version?

0

精彩评论

暂无评论...
验证码 换一张
取 消