ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpapirkovs...@apache.org
Subject ambari git commit: AMBARI-16187. Jersey and Jetty logs should go to server log file. (mpapirkovskyy)
Date Tue, 10 May 2016 16:38:16 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.2 46434ed19 -> ce2e59f22


AMBARI-16187. Jersey and Jetty logs should go to server log file. (mpapirkovskyy)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ce2e59f2
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ce2e59f2
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ce2e59f2

Branch: refs/heads/branch-2.2
Commit: ce2e59f220f6469d7f2d381e14b75b1c44e47344
Parents: 46434ed
Author: Myroslav Papirkovskyi <mpapyrkovskyy@hortonworks.com>
Authored: Tue May 10 17:24:29 2016 +0300
Committer: Myroslav Papirkovskyi <mpapyrkovskyy@hortonworks.com>
Committed: Tue May 10 17:24:29 2016 +0300

----------------------------------------------------------------------
 ambari-server/conf/unix/log4j.properties              |  6 ++++++
 ambari-server/pom.xml                                 |  5 +++++
 .../apache/ambari/server/controller/AmbariServer.java | 14 ++++++++++++++
 3 files changed, 25 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/ce2e59f2/ambari-server/conf/unix/log4j.properties
----------------------------------------------------------------------
diff --git a/ambari-server/conf/unix/log4j.properties b/ambari-server/conf/unix/log4j.properties
index 0ccab22..a213878 100644
--- a/ambari-server/conf/unix/log4j.properties
+++ b/ambari-server/conf/unix/log4j.properties
@@ -69,6 +69,12 @@ log4j.appender.eclipselink.MaxBackupIndex=10
 log4j.appender.eclipselink.layout=org.apache.log4j.PatternLayout
 log4j.appender.eclipselink.layout.ConversionPattern=%m%n
 
+# Jersey
+log4j.logger.org.glassfish.jersey=WARN,file
+
+# Jetty
+log4j.logger.org.eclipse.jetty=WARN,file
+
 log4j.logger.org.apache.hadoop.yarn.client=WARN
 log4j.logger.org.apache.slider.common.tools.SliderUtils=WARN
 log4j.logger.org.apache.ambari.server.security.authorization=WARN

http://git-wip-us.apache.org/repos/asf/ambari/blob/ce2e59f2/ambari-server/pom.xml
----------------------------------------------------------------------
diff --git a/ambari-server/pom.xml b/ambari-server/pom.xml
index 5a91966..d2dd1df 100644
--- a/ambari-server/pom.xml
+++ b/ambari-server/pom.xml
@@ -2047,6 +2047,11 @@
       <version>[0.9.5.2]</version>
       <scope>compile</scope>
     </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>jul-to-slf4j</artifactId>
+      <version>1.7.2</version>
+    </dependency>
   </dependencies>
 
   <pluginRepositories>

http://git-wip-us.apache.org/repos/asf/ambari/blob/ce2e59f2/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
index 0bf12a0..e3a39d9 100644
--- a/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
+++ b/ambari-server/src/main/java/org/apache/ambari/server/controller/AmbariServer.java
@@ -28,6 +28,7 @@ import java.net.URL;
 import java.util.EnumSet;
 import java.util.Enumeration;
 import java.util.Map;
+import java.util.logging.LogManager;
 
 import javax.crypto.BadPaddingException;
 import javax.servlet.DispatcherType;
@@ -124,6 +125,7 @@ import org.eclipse.jetty.util.ssl.SslContextFactory;
 import org.eclipse.jetty.util.thread.QueuedThreadPool;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.slf4j.bridge.SLF4JBridgeHandler;
 import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
 import org.springframework.context.support.ClassPathXmlApplicationContext;
 import org.springframework.security.core.context.SecurityContextHolder;
@@ -264,6 +266,9 @@ public class AmbariServer {
 
   @SuppressWarnings("deprecation")
   public void run() throws Exception {
+    setupJulLogging();
+
+
     performStaticInjection();
     initDB();
     server = new Server();
@@ -587,6 +592,15 @@ public class AmbariServer {
   }
 
   /**
+   * installs bridge handler which redirects log entries from JUL to Slf4J
+   */
+  private void setupJulLogging() {
+    // install handler for jul to slf4j translation
+    LogManager.getLogManager().reset();
+    SLF4JBridgeHandler.install();
+  }
+
+  /**
    * The Jetty thread pool consists of three basic types of threads:
    * <ul>
    * <li>Acceptors</li>


Mime
View raw message