accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mwa...@apache.org
Subject [1/2] accumulo git commit: ACCUMULO-4588 Simplify Accumulo logging configuration
Date Tue, 28 Feb 2017 18:21:57 GMT
Repository: accumulo
Updated Branches:
  refs/heads/master b91ff70cc -> 61245293a


http://git-wip-us.apache.org/repos/asf/accumulo/blob/61245293/docs/src/main/asciidoc/chapters/kerberos.txt
----------------------------------------------------------------------
diff --git a/docs/src/main/asciidoc/chapters/kerberos.txt b/docs/src/main/asciidoc/chapters/kerberos.txt
index 06d46c2..848ac31 100644
--- a/docs/src/main/asciidoc/chapters/kerberos.txt
+++ b/docs/src/main/asciidoc/chapters/kerberos.txt
@@ -545,11 +545,11 @@ I don't know what is actually failing.
 This will enable lots of extra debugging at the JVM level which is often sufficient to
 diagnose some high-level configuration problem. Client applications can add this system property
by
 hand to the command line and Accumulo server processes or applications started using the
`accumulo`
-script by adding the property to +ACCUMULO_GENERAL_OPTS+ in +accumulo-env.sh+.
+script by adding the property to +JAVA_OPTS+ in +accumulo-env.sh+.
 
 Additionally, you can increase the log4j levels on +org.apache.hadoop.security+, which includes
the
 Hadoop +UserGroupInformation+ class, which will include some high-level debug statements.
This
-can be controlled in your client application, or using +generic_logger.xml+
+can be controlled in your client application, or using +log4j-service.properties+
 
 *Q*: All of my Accumulo processes successfully start and log in with their
 keytab, but they are unable to communicate with each other, showing the

http://git-wip-us.apache.org/repos/asf/accumulo/blob/61245293/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java
----------------------------------------------------------------------
diff --git a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java
b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java
index 2d60b0c..cf1a901 100644
--- a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java
+++ b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloClusterImpl.java
@@ -96,7 +96,6 @@ import org.apache.accumulo.start.Main;
 import org.apache.accumulo.start.classloader.vfs.MiniDFSUtil;
 import org.apache.commons.configuration.AbstractConfiguration;
 import org.apache.commons.configuration.MapConfiguration;
-import org.apache.commons.io.FileUtils;
 import org.apache.commons.vfs2.FileObject;
 import org.apache.commons.vfs2.impl.VFSClassLoader;
 import org.apache.hadoop.conf.Configuration;
@@ -464,14 +463,6 @@ public class MiniAccumuloClusterImpl implements AccumuloCluster {
 
       fileWriter.close();
     }
-
-    // disable audit logging for mini....
-    InputStream auditStream = this.getClass().getResourceAsStream("/auditLog.xml");
-
-    if (auditStream != null) {
-      FileUtils.copyInputStreamToFile(auditStream, new File(config.getConfDir(), "auditLog.xml"));
-    }
-
     clusterControl = new MiniAccumuloClusterControl(this);
   }
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/61245293/minicluster/src/main/resources/auditLog.xml
----------------------------------------------------------------------
diff --git a/minicluster/src/main/resources/auditLog.xml b/minicluster/src/main/resources/auditLog.xml
deleted file mode 100644
index 9b7987e..0000000
--- a/minicluster/src/main/resources/auditLog.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one or more
-  contributor license agreements.  See the NOTICE file distributed with
-  this work for additional information regarding copyright ownership.
-  The ASF licenses this file to You under the Apache License, Version 2.0
-  (the "License"); you may not use this file except in compliance with
-  the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
--->
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
-
-
-
-    <!--  Write out Audit info to an Audit file -->
-    <appender name="Audit" class="org.apache.log4j.DailyRollingFileAppender">
-        <param name="File"           value="${org.apache.accumulo.core.dir.log}/${org.apache.accumulo.core.ip.localhost.hostname}.audit"/>
-        <param name="MaxBackupIndex" value="10"/>
-        <param name="DatePattern" value="'.'yyyy-MM-dd"/>
-        <layout class="org.apache.log4j.PatternLayout">
-            <param name="ConversionPattern" value="%d{yyyy-MM-dd HH:mm:ss,SSS/Z} [%c{2}]
%-5p: %m%n"/>
-        </layout>
-    </appender>
-    <logger name="Audit"  additivity="false">
-        <appender-ref ref="Audit" />
-        <level value="OFF"/>
-    </logger>
-
-
-
-
-
-</log4j:configuration>

http://git-wip-us.apache.org/repos/asf/accumulo/blob/61245293/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 fa936c4..e423497 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
@@ -22,7 +22,6 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
-import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.util.Arrays;
 import java.util.Map.Entry;
@@ -45,14 +44,12 @@ import org.apache.accumulo.server.client.HdfsZooInstance;
 import org.apache.accumulo.server.conf.ServerConfigurationFactory;
 import org.apache.accumulo.server.fs.VolumeManager;
 import org.apache.accumulo.server.util.time.SimpleTimer;
-import org.apache.accumulo.server.watcher.Log4jConfiguration;
 import org.apache.accumulo.server.watcher.MonitorLog4jWatcher;
 import org.apache.accumulo.server.zookeeper.ZooReaderWriter;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
 import org.apache.log4j.Logger;
-import org.apache.log4j.helpers.LogLog;
 import org.apache.zookeeper.KeeperException;
 
 import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
@@ -108,69 +105,20 @@ public class Accumulo {
     return ServerConstants.getInstanceIdLocation(v);
   }
 
-  /**
-   * Finds the best log4j configuration file. A generic file is used only if an application-specific
file is not available. An XML file is preferred over a
-   * properties file, if possible.
-   *
-   * @param confDir
-   *          directory where configuration files should reside
-   * @param application
-   *          application name for configuration file name
-   * @return configuration file name
-   */
-  static String locateLogConfig(String confDir, String application) {
-    String explicitConfigFile = System.getProperty("log4j.configuration");
-    if (explicitConfigFile != null) {
-      return explicitConfigFile;
-    }
-    String[] configFiles = {String.format("%s/%s_logger.xml", confDir, application), String.format("%s/%s_logger.properties",
confDir, application),
-        String.format("%s/examples/%s_logger.xml", confDir, application), String.format("%s/examples/%s_logger.properties",
confDir, application),
-        String.format("%s/generic_logger.xml", confDir), String.format("%s/generic_logger.properties",
confDir),
-        String.format("%s/examples/generic_logger.xml", confDir), String.format("%s/examples/generic_logger.properties",
confDir),};
-    String defaultConfigFile = String.format("%s/examples/generic_logger.xml", confDir);
-    for (String f : configFiles) {
-      if (new File(f).exists()) {
-        return f;
-      }
-    }
-    return defaultConfigFile;
-  }
-
-  public static void setupLogging(String application) throws UnknownHostException {
-    System.setProperty("org.apache.accumulo.core.application", application);
-
-    if (System.getenv("ACCUMULO_LOG_DIR") != null) {
-      System.setProperty("org.apache.accumulo.core.dir.log", System.getenv("ACCUMULO_LOG_DIR"));
-    }
-
-    String localhost = InetAddress.getLocalHost().getHostName();
-    System.setProperty("org.apache.accumulo.core.ip.localhost.hostname", localhost);
-
-    // Use a specific log config, if it exists
-    String logConfigFile = locateLogConfig(System.getenv("ACCUMULO_CONF_DIR"), application);
-    // Turn off messages about not being able to reach the remote logger... we protect against
that.
-    LogLog.setQuietMode(true);
-
-    // Set up local file-based logging right away
-    Log4jConfiguration logConf = new Log4jConfiguration(logConfigFile);
-    logConf.resetLogger();
-  }
-
   public static void init(VolumeManager fs, ServerConfigurationFactory serverConfig, String
application) throws IOException {
     final AccumuloConfiguration conf = serverConfig.getConfiguration();
     final Instance instance = serverConfig.getInstance();
 
-    // Use a specific log config, if it exists
-    final String logConfigFile = locateLogConfig(System.getenv("ACCUMULO_CONF_DIR"), application);
-
-    // Set up polling log4j updates and log-forwarding using information advertised in zookeeper
by the monitor
-    MonitorLog4jWatcher logConfigWatcher = new MonitorLog4jWatcher(instance.getInstanceID(),
logConfigFile);
-    logConfigWatcher.setDelay(5000L);
-    logConfigWatcher.start();
-
-    // Makes sure the log-forwarding to the monitor is configured
-    int[] logPort = conf.getPort(Property.MONITOR_LOG4J_PORT);
-    System.setProperty("org.apache.accumulo.core.host.log.port", Integer.toString(logPort[0]));
+    String logConfigFile = System.getProperty("log4j.configuration");
+    if (logConfigFile != null) {
+      if (logConfigFile.startsWith("file:")) {
+        logConfigFile = logConfigFile.split(":")[1];
+      }
+      // Set up polling log4j updates and log-forwarding using information advertised in
zookeeper by the monitor
+      MonitorLog4jWatcher logConfigWatcher = new MonitorLog4jWatcher(instance.getInstanceID(),
logConfigFile);
+      logConfigWatcher.setDelay(5000L);
+      logConfigWatcher.start();
+    }
 
     log.info(application + " starting");
     log.info("Instance " + serverConfig.getInstance().getInstanceID());

http://git-wip-us.apache.org/repos/asf/accumulo/blob/61245293/server/base/src/main/java/org/apache/accumulo/server/security/AuditedSecurityOperation.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/security/AuditedSecurityOperation.java
b/server/base/src/main/java/org/apache/accumulo/server/security/AuditedSecurityOperation.java
index e5ca006..8f4934b 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/security/AuditedSecurityOperation.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/security/AuditedSecurityOperation.java
@@ -57,7 +57,7 @@ import org.apache.log4j.Logger;
  */
 public class AuditedSecurityOperation extends SecurityOperation {
 
-  public static final String AUDITLOG = "Audit";
+  public static final String AUDITLOG = "org.apache.accumulo.audit";
   public static final Logger audit = Logger.getLogger(AUDITLOG);
 
   public AuditedSecurityOperation(AccumuloServerContext context, Authorizor author, Authenticator
authent, PermissionHandler pm) {

http://git-wip-us.apache.org/repos/asf/accumulo/blob/61245293/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 bea7175..68e4897 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
@@ -32,16 +32,12 @@ public class Log4jConfiguration {
   private final boolean usingProperties;
   private final String filename;
   private final File log4jFile;
-  private final String auditConfig;
 
   public Log4jConfiguration(String filename) {
     requireNonNull(filename, "log4j configuration filename must not be null");
     usingProperties = filename.endsWith(".properties");
     this.filename = filename;
     log4jFile = new File(filename);
-
-    // Read the auditing config
-    auditConfig = String.format("%s/auditLog.xml", System.getenv("ACCUMULO_CONF_DIR"));
   }
 
   public boolean isUsingProperties() {
@@ -58,10 +54,6 @@ public class Log4jConfiguration {
       } else {
         new DOMConfigurator().doConfigure(filename, LogManager.getLoggerRepository());
       }
-
-      // Watch the auditLog.xml for the future updates. Because we reset the subsystem, we
have to reconfigure auditing, too.
-      DOMConfigurator.configureAndWatch(auditConfig, 5000l);
     }
-
   }
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/61245293/server/base/src/main/java/org/apache/accumulo/server/watcher/MonitorLog4jWatcher.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/watcher/MonitorLog4jWatcher.java
b/server/base/src/main/java/org/apache/accumulo/server/watcher/MonitorLog4jWatcher.java
index 103aefc..a0783a4 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/watcher/MonitorLog4jWatcher.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/watcher/MonitorLog4jWatcher.java
@@ -37,8 +37,8 @@ import com.google.common.net.HostAndPort;
 public class MonitorLog4jWatcher extends FileWatchdog implements Watcher {
   private static final Logger log = Logger.getLogger(MonitorLog4jWatcher.class);
 
-  private static final String HOST_PROPERTY_NAME = "org.apache.accumulo.core.host.log";
-  private static final String PORT_PROPERTY_NAME = "org.apache.accumulo.core.host.log.port";
+  private static final String HOST_PROPERTY_NAME = "accumulo.monitor.host";
+  private static final String PORT_PROPERTY_NAME = "accumulo.monitor.log.port";
 
   private final Object lock;
   private final Log4jConfiguration logConfig;

http://git-wip-us.apache.org/repos/asf/accumulo/blob/61245293/server/base/src/test/java/org/apache/accumulo/server/AccumuloTest.java
----------------------------------------------------------------------
diff --git a/server/base/src/test/java/org/apache/accumulo/server/AccumuloTest.java b/server/base/src/test/java/org/apache/accumulo/server/AccumuloTest.java
index 955ee9a..2d99058 100644
--- a/server/base/src/test/java/org/apache/accumulo/server/AccumuloTest.java
+++ b/server/base/src/test/java/org/apache/accumulo/server/AccumuloTest.java
@@ -20,12 +20,9 @@ import static org.easymock.EasyMock.createMock;
 import static org.easymock.EasyMock.expect;
 import static org.easymock.EasyMock.replay;
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
 
-import java.io.File;
 import java.io.FileNotFoundException;
 
-import org.apache.commons.io.FileUtils;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
 import org.apache.hadoop.fs.Path;
@@ -85,54 +82,4 @@ public class AccumuloTest {
 
     assertEquals(-1, Accumulo.getAccumuloPersistentVersion(fs, path));
   }
-
-  @Test
-  public void testLocateLogConfig() throws Exception {
-    File confDir = new File(FileUtils.getTempDirectory(), "AccumuloTest" + System.currentTimeMillis());
-    String confDirName = confDir.getAbsolutePath();
-    assertTrue("Failed to make test configuration directory", confDir.mkdir());
-    try {
-      File appProps = new File(confDir, "flogger_logger.properties");
-      String appPropsName = String.format("%s/flogger_logger.properties", confDirName);
-      FileUtils.touch(appProps);
-      File genericXml = new File(confDir, "generic_logger.xml");
-      String genericXmlName = String.format("%s/generic_logger.xml", confDirName);
-      FileUtils.touch(genericXml);
-
-      assertEquals(appPropsName, Accumulo.locateLogConfig(confDirName, "flogger"));
-      assertEquals(genericXmlName, Accumulo.locateLogConfig(confDirName, "flagger"));
-
-      assertTrue("Failed to delete log configuration file", appProps.delete());
-      assertEquals(genericXmlName, Accumulo.locateLogConfig(confDirName, "flogger"));
-    } finally {
-      FileUtils.deleteDirectory(confDir);
-    }
-  }
-
-  @Test
-  public void testLocateLogConfig_Default() throws Exception {
-    File confDir = new File(FileUtils.getTempDirectory(), "AccumuloTest" + System.currentTimeMillis());
-    String confDirName = confDir.getAbsolutePath();
-    assertTrue("Failed to make test configuration directory", confDir.mkdir());
-    try {
-      String genericXmlName = String.format("%s/examples/generic_logger.xml", confDirName);
-
-      assertEquals(genericXmlName, Accumulo.locateLogConfig(confDirName, "flogger"));
-    } finally {
-      FileUtils.deleteDirectory(confDir);
-    }
-  }
-
-  @Test
-  public void testLocateLogConfig_Explicit() throws Exception {
-    File confDir = new File(FileUtils.getTempDirectory(), "AccumuloTest" + System.currentTimeMillis());
-    String confDirName = confDir.getAbsolutePath();
-    System.setProperty("log4j.configuration", "myconfig.xml");
-    try {
-      assertEquals("myconfig.xml", Accumulo.locateLogConfig(confDirName, "flogger"));
-    } finally {
-      FileUtils.deleteDirectory(confDir);
-      System.clearProperty("log4j.configuration");
-    }
-  }
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/61245293/server/gc/src/main/java/org/apache/accumulo/gc/SimpleGarbageCollector.java
----------------------------------------------------------------------
diff --git a/server/gc/src/main/java/org/apache/accumulo/gc/SimpleGarbageCollector.java b/server/gc/src/main/java/org/apache/accumulo/gc/SimpleGarbageCollector.java
index 1e8553b..90f3457 100644
--- a/server/gc/src/main/java/org/apache/accumulo/gc/SimpleGarbageCollector.java
+++ b/server/gc/src/main/java/org/apache/accumulo/gc/SimpleGarbageCollector.java
@@ -144,7 +144,6 @@ public class SimpleGarbageCollector extends AccumuloServerContext implements
Ifa
 
   public static void main(String[] args) throws UnknownHostException, IOException {
     final String app = "gc";
-    Accumulo.setupLogging(app);
     SecurityUtil.serverLogin(SiteConfiguration.getInstance());
     Instance instance = HdfsZooInstance.getInstance();
     ServerConfigurationFactory conf = new ServerConfigurationFactory(instance);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/61245293/server/master/src/main/java/org/apache/accumulo/master/Master.java
----------------------------------------------------------------------
diff --git a/server/master/src/main/java/org/apache/accumulo/master/Master.java b/server/master/src/main/java/org/apache/accumulo/master/Master.java
index c3443e7..032d6bc 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/Master.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/Master.java
@@ -1436,7 +1436,6 @@ public class Master extends AccumuloServerContext implements LiveTServerSet.List
   public static void main(String[] args) throws Exception {
     try {
       final String app = "master";
-      Accumulo.setupLogging(app);
       SecurityUtil.serverLogin(SiteConfiguration.getInstance());
 
       ServerOpts opts = new ServerOpts();

http://git-wip-us.apache.org/repos/asf/accumulo/blob/61245293/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java
----------------------------------------------------------------------
diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java
index d239a84..346820a 100644
--- a/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java
+++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/Monitor.java
@@ -19,6 +19,8 @@ package org.apache.accumulo.monitor;
 import static com.google.common.util.concurrent.Uninterruptibles.sleepUninterruptibly;
 import static java.nio.charset.StandardCharsets.UTF_8;
 
+import java.net.InetAddress;
+import java.net.UnknownHostException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
@@ -425,7 +427,6 @@ public class Monitor implements HighlyAvailableService {
 
   public static void main(String[] args) throws Exception {
     final String app = "monitor";
-    Accumulo.setupLogging(app);
     SecurityUtil.serverLogin(SiteConfiguration.getInstance());
 
     ServerOpts opts = new ServerOpts();
@@ -496,11 +497,18 @@ public class Monitor implements HighlyAvailableService {
       throw new RuntimeException(e);
     }
 
-    try {
-      log.debug("Using " + hostname + " to advertise monitor location in ZooKeeper");
-
-      String monitorAddress = HostAndPort.fromParts(hostname, server.getPort()).toString();
+    String advertiseHost = hostname;
+    if (advertiseHost.equals("0.0.0.0")) {
+      try {
+        advertiseHost = InetAddress.getLocalHost().getHostName();
+      } catch (UnknownHostException e) {
+        log.error("Unable to get hostname", e);
+      }
+    }
+    log.debug("Using " + advertiseHost + " to advertise monitor location");
 
+    try {
+      String monitorAddress = HostAndPort.fromParts(advertiseHost, server.getPort()).toString();
       ZooReaderWriter.getInstance().putPersistentData(ZooUtil.getRoot(instance) + Constants.ZMONITOR_HTTP_ADDR,
monitorAddress.getBytes(UTF_8),
           NodeExistsPolicy.OVERWRITE);
       log.info("Set monitor address in zookeeper to " + monitorAddress);
@@ -508,8 +516,8 @@ public class Monitor implements HighlyAvailableService {
       log.error("Unable to set monitor HTTP address in zookeeper", ex);
     }
 
-    if (null != hostname) {
-      LogService.startLogListener(Monitor.getContext().getConfiguration(), instance.getInstanceID(),
hostname);
+    if (null != advertiseHost) {
+      LogService.startLogListener(Monitor.getContext().getConfiguration(), instance.getInstanceID(),
advertiseHost);
     } else {
       log.warn("Not starting log4j listener as we could not determine address to use");
     }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/61245293/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java
----------------------------------------------------------------------
diff --git a/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java b/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java
index 7c0d9b2..a6bdaa8 100644
--- a/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java
+++ b/server/tracer/src/main/java/org/apache/accumulo/tracer/TraceServer.java
@@ -378,7 +378,6 @@ public class TraceServer implements Watcher {
 
   public static void main(String[] args) throws Exception {
     final String app = "tracer";
-    Accumulo.setupLogging(app);
     loginTracer(SiteConfiguration.getInstance());
     ServerOpts opts = new ServerOpts();
     opts.parseArgs(app, args);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/61245293/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
----------------------------------------------------------------------
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
index b1b2d72..47a0d18 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
@@ -2945,7 +2945,6 @@ public class TabletServer extends AccumuloServerContext implements Runnable
{
   public static void main(String[] args) throws IOException {
     try {
       final String app = "tserver";
-      Accumulo.setupLogging(app);
       SecurityUtil.serverLogin(SiteConfiguration.getInstance());
       ServerOpts opts = new ServerOpts();
       opts.parseArgs(app, args);

http://git-wip-us.apache.org/repos/asf/accumulo/blob/61245293/start/src/main/java/org/apache/accumulo/start/util/AsyncSocketAppender.java
----------------------------------------------------------------------
diff --git a/start/src/main/java/org/apache/accumulo/start/util/AsyncSocketAppender.java b/start/src/main/java/org/apache/accumulo/start/util/AsyncSocketAppender.java
new file mode 100644
index 0000000..db64ecb
--- /dev/null
+++ b/start/src/main/java/org/apache/accumulo/start/util/AsyncSocketAppender.java
@@ -0,0 +1,111 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.start.util;
+
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.log4j.AsyncAppender;
+import org.apache.log4j.net.SocketAppender;
+import org.apache.log4j.spi.LoggingEvent;
+
+/**
+ * An asynchronous appender that maintains its own internal socket appender. Unlike <code>AsyncAppender</code>,
this appender can be configured with a Log4J
+ * properties file, although in that case no additional appenders can be added.
+ */
+public class AsyncSocketAppender extends AsyncAppender {
+
+  private final SocketAppender socketAppender;
+  private final AtomicBoolean activated = new AtomicBoolean(false);
+
+  /**
+   * Creates a new appender.
+   */
+  public AsyncSocketAppender() {
+    socketAppender = new SocketAppender();
+  }
+
+  /**
+   * Creates a new appender using the given socket appender internally. Use this constructor
for testing only.
+   */
+  AsyncSocketAppender(SocketAppender socketAppender) {
+    this.socketAppender = socketAppender;
+  }
+
+  @Override
+  public void append(final LoggingEvent event) {
+    // Lazy attachment, to avoid calling non-final method in constructor
+    if (!isAttached(socketAppender)) {
+      addAppender(socketAppender);
+    }
+
+    // Lazy activation / connection too, to allow setting host and port
+    if (activated.compareAndSet(false, true)) {
+      socketAppender.activateOptions();
+    }
+
+    super.append(event);
+  }
+
+  // SocketAppender delegate methods
+
+  public String getApplication() {
+    return socketAppender.getApplication();
+  }
+
+  // super.getLocationInfo() will always agree with socketAppender
+  public int getPort() {
+    return socketAppender.getPort();
+  }
+
+  public int getReconnectionDelay() {
+    return socketAppender.getReconnectionDelay();
+  }
+
+  public String getRemoteHost() {
+    return socketAppender.getRemoteHost();
+  }
+
+  public boolean isAdvertiseViaMulticastDNS() {
+    return socketAppender.isAdvertiseViaMulticastDNS();
+  }
+
+  public void setAdvertiseViaMulticastDNS(boolean advertiseViaMulticastDNS) {
+    socketAppender.setAdvertiseViaMulticastDNS(advertiseViaMulticastDNS);
+  }
+
+  public void setApplication(String lapp) {
+    socketAppender.setApplication(lapp);
+  }
+
+  @Override
+  public void setLocationInfo(boolean locationInfo) {
+    super.setLocationInfo(locationInfo);
+    socketAppender.setLocationInfo(locationInfo);
+  }
+
+  public void setPort(int port) {
+    socketAppender.setPort(port);
+  }
+
+  public void setReconnectionDelay(int delay) {
+    socketAppender.setReconnectionDelay(delay);
+  }
+
+  public void setRemoteHost(String host) {
+    socketAppender.setRemoteHost(host);
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/61245293/start/src/test/java/org/apache/accumulo/start/util/AsyncSocketAppenderTest.java
----------------------------------------------------------------------
diff --git a/start/src/test/java/org/apache/accumulo/start/util/AsyncSocketAppenderTest.java
b/start/src/test/java/org/apache/accumulo/start/util/AsyncSocketAppenderTest.java
new file mode 100644
index 0000000..6c73782
--- /dev/null
+++ b/start/src/test/java/org/apache/accumulo/start/util/AsyncSocketAppenderTest.java
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo.start.util;
+
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.net.SocketAppender;
+import org.apache.log4j.spi.LoggingEvent;
+import org.easymock.EasyMock;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+public class AsyncSocketAppenderTest {
+  private SocketAppender sa;
+  private AsyncSocketAppender asa;
+
+  @Before
+  public void setUp() throws Exception {
+    sa = EasyMock.createMock(SocketAppender.class);
+  }
+
+  @Test
+  public void testDelegates() {
+    asa = new AsyncSocketAppender();
+    asa.setApplication("myapp");
+    asa.setLocationInfo(true);
+    asa.setPort(1234);
+    asa.setReconnectionDelay(56);
+    asa.setRemoteHost("remotehost");
+    Assert.assertEquals("myapp", asa.getApplication());
+    Assert.assertEquals(true, asa.getLocationInfo()); // not really delegating
+    Assert.assertEquals(1234, asa.getPort());
+    Assert.assertEquals(56, asa.getReconnectionDelay());
+    Assert.assertEquals("remotehost", asa.getRemoteHost());
+  }
+
+  @Test
+  public void testSetLocationInfo() {
+    sa.setLocationInfo(true);
+    EasyMock.replay(sa);
+    asa = new AsyncSocketAppender(sa);
+    asa.setLocationInfo(true);
+    EasyMock.verify(sa);
+  }
+
+  @Test
+  public void testAppend() {
+    asa = new AsyncSocketAppender(sa);
+    Assert.assertFalse(asa.isAttached(sa));
+    LoggingEvent event1 = new LoggingEvent("java.lang.String", Logger.getRootLogger(), Level.INFO,
"event1", null);
+    LoggingEvent event2 = new LoggingEvent("java.lang.Integer", Logger.getRootLogger(), Level.WARN,
"event2", null);
+    sa.activateOptions();
+    sa.doAppend(event1);
+    sa.doAppend(event2);
+    sa.close();
+    EasyMock.replay(sa);
+    asa.doAppend(event1);
+    asa.doAppend(event2);
+    asa.close(); // forces events to be appended to socket appender
+    Assert.assertTrue(asa.isAttached(sa));
+    EasyMock.verify(sa);
+  }
+}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/61245293/test/src/main/java/org/apache/accumulo/test/AuditMessageIT.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/AuditMessageIT.java b/test/src/main/java/org/apache/accumulo/test/AuditMessageIT.java
index 1f47793..87809ba 100644
--- a/test/src/main/java/org/apache/accumulo/test/AuditMessageIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/AuditMessageIT.java
@@ -81,10 +81,6 @@ public class AuditMessageIT extends ConfigurableMacBase {
 
   @Override
   public void beforeClusterStart(MiniAccumuloConfigImpl cfg) throws Exception {
-    File f = new File(cfg.getConfDir(), "auditLog.xml");
-    if (f.delete()) {
-      log.debug("Deleted " + f);
-    }
     cfg.setNumTservers(1);
   }
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/61245293/test/src/main/java/org/apache/accumulo/test/functional/MonitorLoggingIT.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/MonitorLoggingIT.java
b/test/src/main/java/org/apache/accumulo/test/functional/MonitorLoggingIT.java
deleted file mode 100644
index 2cf9b84..0000000
--- a/test/src/main/java/org/apache/accumulo/test/functional/MonitorLoggingIT.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.accumulo.test.functional;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.io.File;
-import java.net.URL;
-
-import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.IteratorSetting;
-import org.apache.accumulo.core.client.Scanner;
-import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl;
-import org.apache.accumulo.monitor.Monitor;
-import org.apache.accumulo.server.util.Admin;
-import org.apache.commons.io.FileUtils;
-import org.apache.zookeeper.KeeperException;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class MonitorLoggingIT extends ConfigurableMacBase {
-  private static final Logger log = LoggerFactory.getLogger(MonitorLoggingIT.class);
-
-  @Override
-  public void beforeClusterStart(MiniAccumuloConfigImpl cfg) throws Exception {
-    cfg.setNumTservers(1);
-    File confDir = cfg.getConfDir();
-    try {
-      FileUtils.copyInputStreamToFile(MonitorLoggingIT.class.getResourceAsStream("/conf/generic_logger.xml"),
new File(confDir, "generic_logger.xml"));
-      FileUtils.copyInputStreamToFile(MonitorLoggingIT.class.getResourceAsStream("/conf/monitor_logger.xml"),
new File(confDir, "monitor_logger.xml"));
-    } catch (Exception e) {
-      log.error("Failed to copy Log4J XML files to conf dir", e);
-    }
-  }
-
-  private static final int NUM_LOCATION_PASSES = 5;
-  private static final int LOCATION_DELAY_SECS = 5;
-
-  @Override
-  protected int defaultTimeoutSeconds() {
-    return 30 + ((NUM_LOCATION_PASSES + 2) * LOCATION_DELAY_SECS);
-  }
-
-  @Test
-  public void logToMonitor() throws Exception {
-    // Start the monitor.
-    log.debug("Starting Monitor");
-    Process monitor = cluster.exec(Monitor.class);
-
-    // Get monitor location to ensure it is running.
-    String monitorLocation = null;
-    for (int i = 0; i < NUM_LOCATION_PASSES; i++) {
-      Thread.sleep(LOCATION_DELAY_SECS * 1000);
-      try {
-        monitorLocation = getMonitor();
-        break;
-      } catch (KeeperException e) {
-        log.debug("Monitor not up yet, trying again in " + LOCATION_DELAY_SECS + " secs");
-      }
-    }
-    assertNotNull("Monitor failed to start within " + (LOCATION_DELAY_SECS * NUM_LOCATION_PASSES)
+ " secs", monitorLocation);
-    log.debug("Monitor running at " + monitorLocation);
-
-    // The tserver has to observe that the log-forwarding address
-    // changed in ZooKeeper. If we cause the error before the tserver
-    // updates, we'll never see the error on the monitor.
-    Thread.sleep(10000);
-
-    // Attempt a scan with an invalid iterator to force a log message in the monitor.
-    try {
-      Connector c = getConnector();
-      Scanner s = c.createScanner("accumulo.root", new Authorizations());
-      IteratorSetting cfg = new IteratorSetting(100, "incorrect", "java.lang.String");
-      s.addScanIterator(cfg);
-      s.iterator().next();
-    } catch (RuntimeException e) {
-      // expected, the iterator was bad
-    }
-
-    String result = "";
-    while (true) {
-      Thread.sleep(LOCATION_DELAY_SECS * 1000); // extra precaution to ensure monitor has
opportunity to log
-
-      // Verify messages were received at the monitor.
-      URL url = new URL("http://" + monitorLocation + "/log");
-      log.debug("Fetching web page " + url);
-      result = FunctionalTestUtils.readAll(url.openStream());
-      if (result.contains("<pre class='logevent'>")) {
-        break;
-      }
-      log.debug("No messages found, waiting a little longer...");
-    }
-
-    assertTrue("No log messages found", result.contains("<pre class='logevent'>"));
-
-    // Shutdown cleanly.
-    log.debug("Stopping mini accumulo cluster");
-    Process shutdown = cluster.exec(Admin.class, "stopAll");
-    shutdown.waitFor();
-    assertTrue(shutdown.exitValue() == 0);
-    log.debug("success!");
-    monitor.destroy();
-  }
-}

http://git-wip-us.apache.org/repos/asf/accumulo/blob/61245293/test/src/main/resources/conf/generic_logger.xml
----------------------------------------------------------------------
diff --git a/test/src/main/resources/conf/generic_logger.xml b/test/src/main/resources/conf/generic_logger.xml
deleted file mode 100644
index db79efe..0000000
--- a/test/src/main/resources/conf/generic_logger.xml
+++ /dev/null
@@ -1,83 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one or more
-  contributor license agreements.  See the NOTICE file distributed with
-  this work for additional information regarding copyright ownership.
-  The ASF licenses this file to You under the Apache License, Version 2.0
-  (the "License"); you may not use this file except in compliance with
-  the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
--->
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
-
-  <!-- Write out everything at the DEBUG level to the debug log -->
-  <appender name="A2" class="org.apache.log4j.RollingFileAppender">
-     <param name="File"           value="${org.apache.accumulo.core.dir.log}/${org.apache.accumulo.core.application}_${org.apache.accumulo.core.ip.localhost.hostname}.debug.log"/>
-     <param name="MaxFileSize"    value="1000MB"/>
-     <param name="MaxBackupIndex" value="10"/>
-     <param name="Threshold"      value="DEBUG"/>
-     <layout class="org.apache.log4j.PatternLayout">
-       <param name="ConversionPattern" value="%d{ISO8601} [%-8c{2}] %-5p: %m%n"/>
-     </layout>
-  </appender>
-
-  <!--  Write out INFO and higher to the regular log -->
-  <appender name="A3" class="org.apache.log4j.RollingFileAppender">
-     <param name="File"           value="${org.apache.accumulo.core.dir.log}/${org.apache.accumulo.core.application}_${org.apache.accumulo.core.ip.localhost.hostname}.log"/>
-     <param name="MaxFileSize"    value="1000MB"/>
-     <param name="MaxBackupIndex" value="10"/>
-     <param name="Threshold"      value="INFO"/>
-     <layout class="org.apache.log4j.PatternLayout">
-       <param name="ConversionPattern" value="%d{ISO8601} [%-8c{2}] %-5p: %m%n"/>
-     </layout>
-  </appender>
-
-  <!-- Send all logging data to a centralized logger -->
-  <appender name="N1" class="org.apache.log4j.net.SocketAppender">
-     <param name="remoteHost"     value="${org.apache.accumulo.core.host.log}"/>
-     <param name="port"           value="${org.apache.accumulo.core.host.log.port}"/>
-     <param name="application"    value="${org.apache.accumulo.core.application}:${org.apache.accumulo.core.ip.localhost.hostname}"/>
-     <param name="Threshold"      value="WARN"/>
-  </appender>
-
-  <!--  If the centralized logger is down, buffer the log events, but drop them if it
stays down -->
-  <appender name="ASYNC" class="org.apache.log4j.AsyncAppender">
-     <appender-ref ref="N1" />
-  </appender>
-
-  <!-- Log accumulo events to the debug, normal and remote logs. -->
-  <logger name="org.apache.accumulo" additivity="false">
-     <level value="DEBUG"/>
-     <appender-ref ref="A2" />
-     <appender-ref ref="A3" />
-     <appender-ref ref="ASYNC" />
-  </logger>
-
-  <logger name="org.apache.accumulo.core.file.rfile.bcfile">
-     <level value="INFO"/>
-  </logger>
-
-  <logger name="org.mortbay.log">
-     <level value="WARN"/>
-  </logger>
-
-  <logger name="org.apache.zookeeper">
-     <level value="ERROR"/>
-  </logger>
-
-  <!-- Log non-accumulo events to the debug and normal logs. -->
-  <root>
-     <level value="INFO"/>
-     <appender-ref ref="A2" />
-     <appender-ref ref="A3" />
-  </root>
-
-</log4j:configuration>

http://git-wip-us.apache.org/repos/asf/accumulo/blob/61245293/test/src/main/resources/conf/monitor_logger.xml
----------------------------------------------------------------------
diff --git a/test/src/main/resources/conf/monitor_logger.xml b/test/src/main/resources/conf/monitor_logger.xml
deleted file mode 100644
index 91a7671..0000000
--- a/test/src/main/resources/conf/monitor_logger.xml
+++ /dev/null
@@ -1,64 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-  Licensed to the Apache Software Foundation (ASF) under one or more
-  contributor license agreements.  See the NOTICE file distributed with
-  this work for additional information regarding copyright ownership.
-  The ASF licenses this file to You under the Apache License, Version 2.0
-  (the "License"); you may not use this file except in compliance with
-  the License.  You may obtain a copy of the License at
-
-      http://www.apache.org/licenses/LICENSE-2.0
-
-  Unless required by applicable law or agreed to in writing, software
-  distributed under the License is distributed on an "AS IS" BASIS,
-  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-  See the License for the specific language governing permissions and
-  limitations under the License.
--->
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
-
-  <!-- Write out everything at the DEBUG level to the debug log -->
-  <appender name="A2" class="org.apache.log4j.RollingFileAppender">
-     <param name="File"           value="${org.apache.accumulo.core.dir.log}/${org.apache.accumulo.core.application}_${org.apache.accumulo.core.ip.localhost.hostname}.debug.log"/>
-     <param name="MaxFileSize"    value="100MB"/>
-     <param name="MaxBackupIndex" value="10"/>
-     <param name="Threshold"      value="DEBUG"/>
-     <layout class="org.apache.log4j.PatternLayout">
-       <param name="ConversionPattern" value="%d{ISO8601} [%-8c{2}] %-5p: %X{application}
%m%n"/>
-     </layout>
-  </appender>
-
-  <!--  Write out INFO and higher to the regular log -->
-  <appender name="A3" class="org.apache.log4j.RollingFileAppender">
-     <param name="File"           value="${org.apache.accumulo.core.dir.log}/${org.apache.accumulo.core.application}_${org.apache.accumulo.core.ip.localhost.hostname}.log"/>
-     <param name="MaxFileSize"    value="100MB"/>
-     <param name="MaxBackupIndex" value="10"/>
-     <param name="Threshold"      value="INFO"/>
-     <layout class="org.apache.log4j.PatternLayout">
-       <param name="ConversionPattern" value="%d{ISO8601} [%-8c{2}] %-5p: %X{application}
%m%n"/>
-     </layout>
-  </appender>
-
-  <!-- Keep the last few log messages for display to the user -->
-  <appender name="GUI" class="org.apache.accumulo.server.monitor.LogService">
-     <param name="keep"           value="40"/>
-     <param name="Threshold"      value="WARN"/>
-  </appender>
-
-  <!-- Log accumulo messages to debug, normal and GUI -->
-  <logger name="org.apache.accumulo" additivity="false">
-     <level value="DEBUG"/>
-     <appender-ref ref="A2" />
-     <appender-ref ref="A3" />
-     <appender-ref ref="GUI" />
-  </logger>
-
-  <!-- Log non-accumulo messages to debug, normal logs. -->
-  <root>
-     <level value="INFO"/>
-     <appender-ref ref="A2" />
-     <appender-ref ref="A3" />
-  </root>
-
-</log4j:configuration>


Mime
View raw message