Hi Eric,
I think commons-compiler is needed for Janino 2.6 and later. Logback was
tested with Janino 2.4.x and 2.5.x.
If you have a need for java-expressions, try GEventEvaluator even if you
are not familiar with the Groovy language. Contrary to
JaninoEventEvaluator which understands simple expressions,
GEventEvaluator can parse blocks of code. As an example, with using
Janino you would write:
!logger.startsWith("org.apache.http")
||
( logger.equals("org.apache.http.wire") &&
(mdc != null && mdc.get("entity") != null
&&
((String) mdc.get("entity")).contains("someSpecialValue"))
&&
!message.contains("someSecret")
)
In Groovy, this would become:
if(logger.startsWith("org.apache.http"))
return true;
if(mdc?.get("entity") == null)
return false;
String payee = (String) mdc.get("entity");
if(logger.equals("org.apache.http.wire") &&
payee.contains("someSpecialValue") &&
!message.contains("someSecret")) {
return true;
}
return false;
Note the Groovy expression is almost valid Java. My point is that for
most non-trivial expressions the Groovy version will be easier to write
and to read.
Note that while Groovy has advantages over Java as language, the biggest
difference between JaninoEventEvaluator and GEventEvaluator is due to
the former's limitation to boolean expressions. This limitations is
likely to be removed in a future version of logback.
HTH,
--
Ceki
On 11.01.2011 17:12, Eric Hough wrote:
Hi,
I'm using Janino with logback to utilize evaluators after installing
Janino as described at http://logback.qos.ch/setup.html. It's working
great.
However I noticed that over on Janino's site
(http://docs.codehaus.org/display/JANINO/Download#Download-installation)
they require commons-compiler.jar. My question is, does Logback also
require commons-compiler.jar? I just want to make sure I don't run
into a ClassNotFoundException down the road.
Thanks!
_______________________________________________
Logback-user mailing list
[email protected]
http://qos.ch/mailman/listinfo/logback-user