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

Bug 365974

Summary: Need ability to configure jetty Log on android
Product: [RT] Jetty Reporter: Joakim Erdfelt <joakim.erdfelt>
Component: otherAssignee: Project Inbox <jetty-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 7.5.4   
Target Milestone: 7.5.x   
Hardware: All   
OS: All   
Whiteboard:

Description Joakim Erdfelt CLA 2011-12-07 18:23:13 EST
When using jetty-client or websocket-client on android, it is very difficult to setup jetty Log as it requires System properties to configure itself.
(system properties are not a viable way to setup and configure anything on Android)
Comment 1 Joakim Erdfelt CLA 2011-12-08 12:42:52 EST
The techniques established by i-jetty project helps.

Using the AndroidLog from i-jetty and some pre-emptive setting of the Log
before Jetty initializes lets Jetty log be setup appropriately.

AndroidLog from i-jetty source (ASL/EPL Licensed)
http://code.google.com/p/i-jetty/source/browse/trunk/i-jetty/i-jetty-server/src/main/java/org/mortbay/ijetty/log/AndroidLog.java

The following bridging code should be placed in your Activity#onCreate() method

// Bridge Jetty Logging to Android Logging
System.setProperty("org.eclipse.jetty.util.log.class",AndroidLog.class.getName());
org.eclipse.jetty.util.log.Log.setLog(new AndroidLog());