Github user joshelser commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/221#discussion_r103020840
  
    --- Diff: 
server/base/src/main/java/org/apache/accumulo/server/Accumulo.java ---
    @@ -108,69 +105,20 @@ public static synchronized Path 
getAccumuloInstanceIdPath(VolumeManager fs) {
         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:")) {
    --- End diff --
    
    Ok, I wasn't sure if there was some Log4j class intended to parse this. Not 
a problem since we're only doing it once.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to