From 7ba3675fbf9b82b59f4a4ea46ef05ebe287a8865 Mon Sep 17 00:00:00 2001 From: massakam Date: Wed, 25 Oct 2017 00:13:06 +0900 Subject: [PATCH] Change timezone of request log from GMT to local one (#841) --- .../main/java/org/apache/pulsar/broker/web/WebService.java | 4 ++-- .../apache/pulsar/discovery/service/server/ServerManager.java | 3 ++- .../main/java/org/apache/pulsar/proxy/server/WebServer.java | 3 ++- .../java/org/apache/pulsar/websocket/service/ProxyServer.java | 3 ++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/WebService.java b/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/WebService.java index 641798f803d9d..cf5e1eaf29fca 100644 --- a/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/WebService.java +++ b/pulsar-broker/src/main/java/org/apache/pulsar/broker/web/WebService.java @@ -22,6 +22,7 @@ import java.util.ArrayList; import java.util.EnumSet; import java.util.List; +import java.util.TimeZone; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import java.util.regex.Matcher; @@ -75,7 +76,6 @@ public class WebService implements AutoCloseable { public static final String ATTRIBUTE_PULSAR_NAME = "pulsar"; public static final String HANDLER_CACHE_CONTROL = "max-age=3600"; - public static final String HANDLER_REQUEST_LOG_TZ = "GMT"; public static final int NUM_ACCEPTORS = 32; // make it configurable? public static final int MAX_CONCURRENT_REQUESTES = 1024; // make it configurable? @@ -195,7 +195,7 @@ public void start() throws PulsarServerException { RequestLogHandler requestLogHandler = new RequestLogHandler(); Slf4jRequestLog requestLog = new Slf4jRequestLog(); requestLog.setExtended(true); - requestLog.setLogTimeZone(WebService.HANDLER_REQUEST_LOG_TZ); + requestLog.setLogTimeZone(TimeZone.getDefault().getID()); requestLog.setLogLatency(true); requestLogHandler.setRequestLog(requestLog); handlers.add(0, new ContextHandlerCollection()); diff --git a/pulsar-discovery-service/src/main/java/org/apache/pulsar/discovery/service/server/ServerManager.java b/pulsar-discovery-service/src/main/java/org/apache/pulsar/discovery/service/server/ServerManager.java index 54914e8e3e91f..d8be507490f6d 100644 --- a/pulsar-discovery-service/src/main/java/org/apache/pulsar/discovery/service/server/ServerManager.java +++ b/pulsar-discovery-service/src/main/java/org/apache/pulsar/discovery/service/server/ServerManager.java @@ -22,6 +22,7 @@ import java.security.GeneralSecurityException; import java.util.List; import java.util.Map; +import java.util.TimeZone; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -113,7 +114,7 @@ public void start() throws Exception { RequestLogHandler requestLogHandler = new RequestLogHandler(); Slf4jRequestLog requestLog = new Slf4jRequestLog(); requestLog.setExtended(true); - requestLog.setLogTimeZone("GMT"); + requestLog.setLogTimeZone(TimeZone.getDefault().getID()); requestLog.setLogLatency(true); requestLogHandler.setRequestLog(requestLog); handlers.add(0, new ContextHandlerCollection()); diff --git a/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/WebServer.java b/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/WebServer.java index 7316a834f7535..a809a3dd01b5f 100644 --- a/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/WebServer.java +++ b/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/WebServer.java @@ -21,6 +21,7 @@ import java.net.URI; import java.security.GeneralSecurityException; import java.util.List; +import java.util.TimeZone; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -106,7 +107,7 @@ public void start() throws Exception { RequestLogHandler requestLogHandler = new RequestLogHandler(); Slf4jRequestLog requestLog = new Slf4jRequestLog(); requestLog.setExtended(true); - requestLog.setLogTimeZone("GMT"); + requestLog.setLogTimeZone(TimeZone.getDefault().getID()); requestLog.setLogLatency(true); requestLogHandler.setRequestLog(requestLog); handlers.add(0, new ContextHandlerCollection()); diff --git a/pulsar-websocket/src/main/java/org/apache/pulsar/websocket/service/ProxyServer.java b/pulsar-websocket/src/main/java/org/apache/pulsar/websocket/service/ProxyServer.java index 3ab5ea022a93d..ff1bfe5eba441 100644 --- a/pulsar-websocket/src/main/java/org/apache/pulsar/websocket/service/ProxyServer.java +++ b/pulsar-websocket/src/main/java/org/apache/pulsar/websocket/service/ProxyServer.java @@ -24,6 +24,7 @@ import java.security.GeneralSecurityException; import java.util.ArrayList; import java.util.List; +import java.util.TimeZone; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; @@ -133,7 +134,7 @@ public void start() throws PulsarServerException { RequestLogHandler requestLogHandler = new RequestLogHandler(); Slf4jRequestLog requestLog = new Slf4jRequestLog(); requestLog.setExtended(true); - requestLog.setLogTimeZone("GMT"); + requestLog.setLogTimeZone(TimeZone.getDefault().getID()); requestLog.setLogLatency(true); requestLogHandler.setRequestLog(requestLog); handlers.add(0, new ContextHandlerCollection());