summaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-07-27 23:29:26 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-07-27 23:29:26 +0000
commit33eb2b3bdab8da15b6492db0be3602fc9624e79d (patch)
treeb5ae9b171b58856bd1614b76b9394802204a1fd4 /java
parentd70be8fac6cfc3c169eced1fb1cee75546445977 (diff)
Use API to set jetty logger
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@798331 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java')
-rw-r--r--java/sca/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyServer.java19
1 files changed, 14 insertions, 5 deletions
diff --git a/java/sca/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyServer.java b/java/sca/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyServer.java
index 8adccdd8f0..ddfa253f55 100644
--- a/java/sca/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyServer.java
+++ b/java/sca/modules/host-jetty/src/main/java/org/apache/tuscany/sca/http/jetty/JettyServer.java
@@ -54,6 +54,7 @@ import org.mortbay.jetty.servlet.ServletHandler;
import org.mortbay.jetty.servlet.ServletHolder;
import org.mortbay.jetty.servlet.ServletMapping;
import org.mortbay.jetty.servlet.SessionHandler;
+import org.mortbay.log.Log;
import org.mortbay.thread.ThreadPool;
/**
@@ -103,14 +104,17 @@ public class JettyServer implements ServletHost {
private Map<Integer, Port> ports = new HashMap<Integer, Port>();
private String contextPath = "/";
-
- static {
- // Hack to replace the static Jetty logger
- System.setProperty("org.mortbay.log.class", JettyLogger.class.getName());
- }
+ private org.mortbay.log.Logger jettyLogger;
public JettyServer(WorkScheduler workScheduler) {
this.workScheduler = workScheduler;
+ try {
+ jettyLogger = Log.getLog();
+ } catch (Throwable e) {
+ // Ignore
+ } finally {
+ Log.setLog(new JettyLogger());
+ }
AccessController.doPrivileged(new PrivilegedAction<Object>() {
public Object run() {
trustStore = System.getProperty("javax.net.ssl.trustStore");
@@ -153,6 +157,11 @@ public class JettyServer implements ServletHost {
}
} catch (Exception e) {
throw new ServletMappingException(e);
+ } finally {
+ if (jettyLogger != null) {
+ Log.setLog(jettyLogger);
+ jettyLogger = null;
+ }
}
}