Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 333582

Summary: unable to use logback filters
Product: [RT] Virgo Reporter: Eric Hough <k2eric>
Component: runtimeAssignee: Project Inbox <virgo-inbox>
Status: CLOSED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: glyn.normington, k2eric
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
stack trace on startup
none
sample config/serviceability.xml
none
sample config/serviceability.xml none

Description Eric Hough CLA 2011-01-05 11:35:07 EST
Build Identifier: 2.1.0.RELEASE

I can't seem to add a Logback filter to my config/serviceability.xml. The error at startup is

java.lang.ClassNotFoundException: org.codehaus.janino.ExpressionEvaluator

It appears that most of the logback filter functionality relies on Janino (http://docs.codehaus.org/display/JANINO/Home). I grabbed Janino 2.5.15 from Spring's EBR and added it as a kernel bundle (following the Virgo docs on how to add bundles to the kernel via the launcher.bundles property). Still no dice. Then I tried modifying the manifest for org.eclipse.virgo.medic.core-2.1.0.RELEASE.jar to import the org.codehaus.janino package. No luck.

Help?

Reproducible: Always

Steps to Reproduce:
1. Grab fresh copy of Virgo 2.1.0.RELEASE
2. Add any Logback filter to any appender in config/serviceability.xml. e.g. try a simple "matcher": http://logback.qos.ch/manual/filters.html#matcher
3. Observe stack trace on Virgo startup
Comment 1 Eric Hough CLA 2011-01-05 11:36:16 EST
Created attachment 186099 [details]
stack trace on startup
Comment 2 Eric Hough CLA 2011-01-05 11:38:43 EST
Created attachment 186101 [details]
sample config/serviceability.xml
Comment 3 Eric Hough CLA 2011-01-05 11:40:43 EST
Created attachment 186102 [details]
sample config/serviceability.xml

Bugzilla seems to have stripped out all the XML from my first attachment. Trying again...
Comment 4 Glyn Normington CLA 2011-01-06 03:39:45 EST
(In reply to comment #0)
> Build Identifier: 2.1.0.RELEASE
> 
> I can't seem to add a Logback filter to my config/serviceability.xml. The error
> at startup is
> 
> java.lang.ClassNotFoundException: org.codehaus.janino.ExpressionEvaluator
> 
> It appears that most of the logback filter functionality relies on Janino
> (http://docs.codehaus.org/display/JANINO/Home). I grabbed Janino 2.5.15 from
> Spring's EBR and added it as a kernel bundle (following the Virgo docs on how
> to add bundles to the kernel via the launcher.bundles property). Still no dice.
> Then I tried modifying the manifest for
> org.eclipse.virgo.medic.core-2.1.0.RELEASE.jar to import the
> org.codehaus.janino package. No luck.
> 
> Help?

That's what I would have recommended, but by attaching a fragment bundle containing just the new import to medic core. This fragment bundle needs to go in lib/kernel and be installed by being added to the launcher.bundles, without @start, in lib/org.eclipse.virgo.kernel.launch.properties.

I would check the wiring by removing the appender configuration temporarily, configuring the Equinox console to start in the kernel, e.g. by running:

bin/startup.sh -clean -Fosgi.console=2402

Then you can telnet in to 2402 and examine the wiring of the medic core bundle.

If you still get the ClassNotFoundException and the wiring looks right, then check the Janino bundle actually contains that class.
Comment 5 Eric Hough CLA 2011-01-06 11:33:27 EST
> That's what I would have recommended, but by attaching a fragment bundle
> containing just the new import to medic core. This fragment bundle needs to go
> in lib/kernel and be installed by being added to the launcher.bundles, without
> @start, in lib/org.eclipse.virgo.kernel.launch.properties.

We have a winner! These instructions worked great, and is cleaner because it doesn't require modifying the manifest for medic core. Not really sure why this worked over the way I tried yesterday, but it was probably a typo on my part. Thank you!

Would be great to have this functionality built in to Virgo. Logback is so powerful that it's a (small) shame not to be able to use all its features in out-of-the-box Virgo. Is this something that would be feasible with the whole Eclipse IP process? Should I open a new ticket for this?
Comment 6 Glyn Normington CLA 2011-01-10 04:19:43 EST
Glad you are sorted. Please do open an enhancement bug to cover your requirement. (I don't see any issue with the Eclipse IP process, however. If necessary we can discuss in the other bug to keep the discussion in one place.)
Comment 7 Eric Hough CLA 2011-01-10 16:59:02 EST
Feature request filed as bug #333920.
Comment 8 Glyn Normington CLA 2011-01-11 03:17:48 EST
(In reply to comment #7)
> Feature request filed as bug #333920.

Thanks Eric!
Comment 9 Glyn Normington CLA 2011-02-28 10:29:45 EST
Closing the bug as "works for me" as there is a way of getting it going. Bug 333920 covers any future enhancement.