You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by el...@apache.org on 2014/10/27 20:12:59 UTC

[1/3] git commit: ACCUMULO-3264 Only reset logging configuration when we're certain that we have configuration files

Repository: accumulo
Updated Branches:
  refs/heads/1.6 8b93f5d18 -> e4dbe897c
  refs/heads/master b97527181 -> 014d9d955


ACCUMULO-3264 Only reset logging configuration when we're certain that we have configuration files

The original change broke logging for all of the ITs because
the logging configuration was reset without having any means
to add back the original log4j configuration from maven.

This shouldn't have been a problem because MAC should really
be setting up logging in the same way that a real cluster does
instead of faking it.


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

Branch: refs/heads/1.6
Commit: e4dbe897cfbd710549a0368e156a49181409a671
Parents: 8b93f5d
Author: Josh Elser <el...@apache.org>
Authored: Mon Oct 27 14:57:10 2014 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Mon Oct 27 14:57:10 2014 -0400

----------------------------------------------------------------------
 .../org/apache/accumulo/server/Accumulo.java     |  5 +++--
 .../server/watcher/Log4jConfiguration.java       | 19 +++++++++++++------
 2 files changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/e4dbe897/server/base/src/main/java/org/apache/accumulo/server/Accumulo.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/Accumulo.java b/server/base/src/main/java/org/apache/accumulo/server/Accumulo.java
index 0dc76b2..1e7658a 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/Accumulo.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/Accumulo.java
@@ -161,11 +161,12 @@ public class Accumulo {
     // Read the auditing config
     String auditConfig = String.format("%s/auditLog.xml", System.getenv("ACCUMULO_CONF_DIR"));
 
-    DOMConfigurator.configureAndWatch(auditConfig, 5000);
-
     // Set up local file-based logging right away
     Log4jConfiguration logConf = new Log4jConfiguration(logConfigFile);
     logConf.resetLogger();
+
+    // Watch the auditLog.xml for the future updates
+    DOMConfigurator.configureAndWatch(auditConfig, 5000);
   }
 
   public static void init(VolumeManager fs, ServerConfiguration serverConfig, String application) throws IOException {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/e4dbe897/server/base/src/main/java/org/apache/accumulo/server/watcher/Log4jConfiguration.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/watcher/Log4jConfiguration.java b/server/base/src/main/java/org/apache/accumulo/server/watcher/Log4jConfiguration.java
index 7dea7a3..0cac730 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/watcher/Log4jConfiguration.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/watcher/Log4jConfiguration.java
@@ -16,6 +16,8 @@
  */
 package org.apache.accumulo.server.watcher;
 
+import java.io.File;
+
 import org.apache.log4j.LogManager;
 import org.apache.log4j.PropertyConfigurator;
 import org.apache.log4j.xml.DOMConfigurator;
@@ -27,10 +29,12 @@ public class Log4jConfiguration {
 
   private final boolean usingProperties;
   private final String filename;
+  private final File log4jFile;
 
   public Log4jConfiguration(String filename) {
     usingProperties = (filename != null && filename.endsWith(".properties"));
     this.filename = filename;
+    log4jFile = new File(filename);
   }
 
   public boolean isUsingProperties() {
@@ -38,12 +42,15 @@ public class Log4jConfiguration {
   }
 
   public void resetLogger() {
-    // Force a reset on the logger's configuration
-    LogManager.resetConfiguration();
-    if (usingProperties) {
-      new PropertyConfigurator().doConfigure(filename, LogManager.getLoggerRepository());
-    } else {
-      new DOMConfigurator().doConfigure(filename, LogManager.getLoggerRepository());
+    // Force a reset on the logger's configuration, but only if the configured log4j file actually exists
+    // If we reset the configuration blindly, the ITs will not get any logging as they don't set it up on their own
+    if (log4jFile.exists() && log4jFile.isFile() && log4jFile.canRead()) {
+      LogManager.resetConfiguration();
+      if (usingProperties) {
+        new PropertyConfigurator().doConfigure(filename, LogManager.getLoggerRepository());
+      } else {
+        new DOMConfigurator().doConfigure(filename, LogManager.getLoggerRepository());
+      }
     }
   }
 }


[2/3] git commit: ACCUMULO-3264 Only reset logging configuration when we're certain that we have configuration files

Posted by el...@apache.org.
ACCUMULO-3264 Only reset logging configuration when we're certain that we have configuration files

The original change broke logging for all of the ITs because
the logging configuration was reset without having any means
to add back the original log4j configuration from maven.

This shouldn't have been a problem because MAC should really
be setting up logging in the same way that a real cluster does
instead of faking it.


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

Branch: refs/heads/master
Commit: e4dbe897cfbd710549a0368e156a49181409a671
Parents: 8b93f5d
Author: Josh Elser <el...@apache.org>
Authored: Mon Oct 27 14:57:10 2014 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Mon Oct 27 14:57:10 2014 -0400

----------------------------------------------------------------------
 .../org/apache/accumulo/server/Accumulo.java     |  5 +++--
 .../server/watcher/Log4jConfiguration.java       | 19 +++++++++++++------
 2 files changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/e4dbe897/server/base/src/main/java/org/apache/accumulo/server/Accumulo.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/Accumulo.java b/server/base/src/main/java/org/apache/accumulo/server/Accumulo.java
index 0dc76b2..1e7658a 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/Accumulo.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/Accumulo.java
@@ -161,11 +161,12 @@ public class Accumulo {
     // Read the auditing config
     String auditConfig = String.format("%s/auditLog.xml", System.getenv("ACCUMULO_CONF_DIR"));
 
-    DOMConfigurator.configureAndWatch(auditConfig, 5000);
-
     // Set up local file-based logging right away
     Log4jConfiguration logConf = new Log4jConfiguration(logConfigFile);
     logConf.resetLogger();
+
+    // Watch the auditLog.xml for the future updates
+    DOMConfigurator.configureAndWatch(auditConfig, 5000);
   }
 
   public static void init(VolumeManager fs, ServerConfiguration serverConfig, String application) throws IOException {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/e4dbe897/server/base/src/main/java/org/apache/accumulo/server/watcher/Log4jConfiguration.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/watcher/Log4jConfiguration.java b/server/base/src/main/java/org/apache/accumulo/server/watcher/Log4jConfiguration.java
index 7dea7a3..0cac730 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/watcher/Log4jConfiguration.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/watcher/Log4jConfiguration.java
@@ -16,6 +16,8 @@
  */
 package org.apache.accumulo.server.watcher;
 
+import java.io.File;
+
 import org.apache.log4j.LogManager;
 import org.apache.log4j.PropertyConfigurator;
 import org.apache.log4j.xml.DOMConfigurator;
@@ -27,10 +29,12 @@ public class Log4jConfiguration {
 
   private final boolean usingProperties;
   private final String filename;
+  private final File log4jFile;
 
   public Log4jConfiguration(String filename) {
     usingProperties = (filename != null && filename.endsWith(".properties"));
     this.filename = filename;
+    log4jFile = new File(filename);
   }
 
   public boolean isUsingProperties() {
@@ -38,12 +42,15 @@ public class Log4jConfiguration {
   }
 
   public void resetLogger() {
-    // Force a reset on the logger's configuration
-    LogManager.resetConfiguration();
-    if (usingProperties) {
-      new PropertyConfigurator().doConfigure(filename, LogManager.getLoggerRepository());
-    } else {
-      new DOMConfigurator().doConfigure(filename, LogManager.getLoggerRepository());
+    // Force a reset on the logger's configuration, but only if the configured log4j file actually exists
+    // If we reset the configuration blindly, the ITs will not get any logging as they don't set it up on their own
+    if (log4jFile.exists() && log4jFile.isFile() && log4jFile.canRead()) {
+      LogManager.resetConfiguration();
+      if (usingProperties) {
+        new PropertyConfigurator().doConfigure(filename, LogManager.getLoggerRepository());
+      } else {
+        new DOMConfigurator().doConfigure(filename, LogManager.getLoggerRepository());
+      }
     }
   }
 }


[3/3] git commit: Merge branch '1.6'

Posted by el...@apache.org.
Merge branch '1.6'


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

Branch: refs/heads/master
Commit: 014d9d95549911e131dfa5509cd347193151bad4
Parents: b975271 e4dbe89
Author: Josh Elser <el...@apache.org>
Authored: Mon Oct 27 14:59:01 2014 -0400
Committer: Josh Elser <el...@apache.org>
Committed: Mon Oct 27 14:59:01 2014 -0400

----------------------------------------------------------------------
 .../org/apache/accumulo/server/Accumulo.java     |  5 +++--
 .../server/watcher/Log4jConfiguration.java       | 19 +++++++++++++------
 2 files changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/014d9d95/server/base/src/main/java/org/apache/accumulo/server/Accumulo.java
----------------------------------------------------------------------
diff --cc server/base/src/main/java/org/apache/accumulo/server/Accumulo.java
index 80dff9b,1e7658a..e4d6264
--- a/server/base/src/main/java/org/apache/accumulo/server/Accumulo.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/Accumulo.java
@@@ -165,11 -164,12 +165,12 @@@ public class Accumulo 
      // Set up local file-based logging right away
      Log4jConfiguration logConf = new Log4jConfiguration(logConfigFile);
      logConf.resetLogger();
+ 
+     // Watch the auditLog.xml for the future updates
+     DOMConfigurator.configureAndWatch(auditConfig, 5000);
    }
  
 -  public static void init(VolumeManager fs, ServerConfiguration serverConfig, String application) throws IOException {
 +  public static void init(VolumeManager fs, ServerConfigurationFactory serverConfig, String application) throws IOException {
      final AccumuloConfiguration conf = serverConfig.getConfiguration();
      final Instance instance = serverConfig.getInstance();