Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 355479 - java.util.logging (JUL) produces System.err in Virgo logs
Summary: java.util.logging (JUL) produces System.err in Virgo logs
Status: CLOSED FIXED
Alias: None
Product: Virgo
Classification: RT
Component: runtime (show other bugs)
Version: 3.0.0.RC1   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 3.0.2.RELEASE   Edit
Assignee: Hristo Iliev CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on: 358129
Blocks: 352768
  Show dependency tree
 
Reported: 2011-08-23 05:54 EDT by Hristo Iliev CLA
Modified: 2011-11-16 08:55 EST (History)
1 user (show)

See Also:


Attachments
Virgo Startup Listener bundle (6.54 KB, application/x-java-archive)
2011-08-23 05:54 EDT, Hristo Iliev CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Hristo Iliev CLA 2011-08-23 05:54:04 EDT
Created attachment 201982 [details]
Virgo Startup Listener bundle

I'm trying to use JUL from a simple bundle [1] running in Virgo.

The resulting message has the format:

[2011-08-23 11:58:05.040] ERROR fs-watcher                   System.err                                                        Aug 23, 2011 11:58:05 AM org.cloudfoundry.virgo.startup.VirgoStartupListener start
[2011-08-23 11:58:05.040] ERROR fs-watcher                   System.err                                                        INFO: Starting deployment of [artifacts/d20110823-12157-1727cjf.jar]

[1] https://github.com/hsiliev/vcap-java/blob/virgo/plugins/org.cloudfoundry.plugins.virgo/src/main/java/org/cloudfoundry/virgo/startup/VirgoStartupListener.java
Comment 1 Hristo Iliev CLA 2011-08-23 05:55:36 EDT
This might be connected to bug 352768
Comment 2 Glyn Normington CLA 2011-08-24 03:11:09 EDT
(In reply to comment #1)
> This might be connected to bug 352768

That seems likely. For bug 352768, I believe the default Tomcat support for JUL is redirecting logs to syserr. Apparently we need to write our own console handler to fix this.
Comment 3 Hristo Iliev CLA 2011-09-13 09:54:06 EDT
I installed jul-to-slf4j bridge [1] in the medic and configured the LevelChangePropagator [2]. For this to work I had to move slf4j.bridge bundle (containing the SLF4JBridgeHandler) in the kernel so medic can call its install() method.

The LevelChangePropagator is not available in logback 0.9.24 so I updated logback to 0.9.28.

This proved to be enough to get the JUL logs working for both my test bundle and Tomcat. One complication however is the fact that JUL has by default ConsoleHandler configured on root logger. This is the reason to have the JUL log entries twice - the first time from the logger and the second from System.err/out.

To solve the problem with the default ConsoleHandler I added some logic that removes it from the root logger. Since someone may have configuration including ConsoleHandler I made this configurable.

The move of slf4j.bridge bundle requires some tweaking of the test configurations.

[1] http://www.slf4j.org/legacy.html#jul-to-slf4j
[2] http://logback.qos.ch/manual/configuration.html#LevelChangePropagator
[3] http://www.slf4j.org/api/org/slf4j/bridge/SLF4JBridgeHandler.html
Comment 4 Hristo Iliev CLA 2011-09-19 11:13:56 EDT
Added dependency on bug 358129 since the medic configuration is not used
Comment 5 Hristo Iliev CLA 2011-09-27 04:49:08 EDT
The bridge and propagator are in medic with commit 1245d0a5a027552852aa621a29728fb8a81f7069

The kernel includes SLF4J bridge with commit d809f45a5245d7b57a6353b06e6f791203baabbb

Changed tests with commits:
1848e47681a15d8dd25ab6d3e71c59f946d68b7e - app
b058f3af7b706959ab2e97df62a0c0cb4aa26c68 - web
b0ed9b6ed0dbc30dc2a8fc8164b3386e9ed147fc - snaps
Comment 6 Hristo Iliev CLA 2011-09-29 03:49:15 EDT
User Guide updated with commit d86764f9d325827efdf65789363bbeff866ce506
Comment 7 Hristo Iliev CLA 2011-11-16 08:55:19 EST
Cherry picked in 3.0.2 with
   * kernel: aea42be2467a7e40bda5ff27a12defca1beea301
   * medic: f0a1a06ca118f5dc8090826bb3263f1c55d83428
   * app: 5743506ef33abd47111542291cfea59934d30015
   * web: b6515557c30ff87f054ac22ab5036e199e9de2ec
   * snaps: e15b88b14485596e67dd6b477092e275db456334
   * doc:  dbe4b2542ae7820ea71a14c58fca3711251fe9f3