Thank you for your detailed response! I considered using GEventEvaluator but in my experience Groovy has added more of a memory/performance overhead than I'm willing to take on. The syntax is undoubtedly more concise, but I'm not using expressions that are more than 1 or 2 lines, so for me Janino will work just fine. Thanks again.
Eric On Tue, Jan 11, 2011 at 9:36 AM, Ceki Gulcu <[email protected]> wrote: > 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 > _______________________________________________ Logback-user mailing list [email protected] http://qos.ch/mailman/listinfo/logback-user
