SLIDER-555 server-side log4j
diff --git a/slider-core/src/main/java/org/apache/slider/client/SliderClient.java b/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
index 676d865..b9ed2b5 100644
--- a/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
+++ b/slider-core/src/main/java/org/apache/slider/client/SliderClient.java
@@ -1175,6 +1175,7 @@
     Map<String, LocalResource> localResources = amLauncher.getLocalResources();
     
     // look for the configuration directory named on the command line
+    boolean hasServerLog4jProperties = false;
     Path remoteConfPath = null;
     String relativeConfDir = null;
     String confdirProp =
@@ -1192,6 +1193,10 @@
       log.debug("Slider configuration directory is {}; remote to be {}",
     		  localConfDirPath, remoteConfPath);
       SliderUtils.copyDirectory(config, localConfDirPath, remoteConfPath, null);
+
+      File log4jserver =
+          new File(confDir, SliderKeys.LOG4J_SERVER_PROP_FILENAME);
+      hasServerLog4jProperties = log4jserver.isFile();
     }
     // the assumption here is that minimr cluster => this is a test run
     // and the classpath can look after itself
@@ -1319,6 +1324,12 @@
     sliderAM.addJVMOptions(instanceDefinition, commandLine);
     // enable asserts if the text option is set
     commandLine.enableJavaAssertions();
+    
+    // if the conf dir has a log4j-server.properties, switch to that
+    if (hasServerLog4jProperties) {
+      commandLine.sysprop(SYSPROP_LOG4_CONFIGURATION, LOG4J_SERVER_PROP_FILENAME);
+    }
+    
     // add the AM sevice entry point
     commandLine.add(SliderAppMaster.SERVICE_CLASSNAME);
 
diff --git a/slider-core/src/main/java/org/apache/slider/common/SliderKeys.java b/slider-core/src/main/java/org/apache/slider/common/SliderKeys.java
index 1a94d83..9e721cf 100644
--- a/slider-core/src/main/java/org/apache/slider/common/SliderKeys.java
+++ b/slider-core/src/main/java/org/apache/slider/common/SliderKeys.java
@@ -133,16 +133,21 @@
   String SUBMITTED_CONF_DIR = "confdir";
 
   /**
-   * Slider AM log4j file name 
+   * Slider AM log4j file name : {@value}
    */
   String LOG4J_SERVER_PROP_FILENAME = "log4j-server.properties";
 
   /**
-   * Standard log4j file name 
+   * Standard log4j file name  : {@value}
    */
   String LOG4J_PROP_FILENAME = "log4j.properties";
 
   /**
+   * Log4j sysprop to name the resource :{@value}
+   */
+  String SYSPROP_LOG4_CONFIGURATION = "log4j.configuration";
+
+  /**
    * name of the Slider client resource
    * loaded when the service is loaded.
    */
diff --git a/slider-core/src/main/java/org/apache/slider/common/tools/SliderUtils.java b/slider-core/src/main/java/org/apache/slider/common/tools/SliderUtils.java
index 0ff5ccb..82b17fd 100644
--- a/slider-core/src/main/java/org/apache/slider/common/tools/SliderUtils.java
+++ b/slider-core/src/main/java/org/apache/slider/common/tools/SliderUtils.java
@@ -415,9 +415,7 @@
       new SliderFileSystem(destFS, conf).createWithPermissions(destDirPath,
           permission);
     }
-    // Slider AM now has its own log4j-server.properties file
-    List<Path> sourcePaths = new ArrayList<Path>();
-    Path serverLog4jPath = null;
+    Path[] sourcePaths = new Path[srcFileCount];
     for (int i = 0; i < srcFileCount; i++) {
       FileStatus e = entries[i];
       Path srcFile = e.getPath();
@@ -427,32 +425,13 @@
         log.warn(msg);
         throw new IOException(msg);
       }
-      if (SliderKeys.LOG4J_SERVER_PROP_FILENAME.equals(srcFile.getName())) {
-        // log4j-server.properties will be copied as log4j.properties
-        serverLog4jPath = srcFile;
-        log.debug("copying src conf file {} as {}", srcFile,
-            SliderKeys.LOG4J_PROP_FILENAME);
-        continue;
-      }
-      if (SliderKeys.LOG4J_PROP_FILENAME.equals(srcFile.getName())) {
-        // ignore log4j.properties entirely for Slider AM
-        log.debug("ignoring file {}", srcFile);
-        continue;
-      }
       log.debug("copying src conf file {}", srcFile);
-      sourcePaths.add(srcFile);
+      sourcePaths[i] = srcFile;
     }
-    log.debug("Copying {} files from {} to dest {}", 
-        sourcePaths.size() + (serverLog4jPath != null ? 1 : 0),
+    log.debug("Copying {} files from {} to dest {}", srcFileCount,
         srcDirPath,
         destDirPath);
-    FileUtil.copy(srcFS, sourcePaths.toArray(new Path[0]), destFS, destDirPath,
-        false, true, conf);
-    // Now copy log4j-server.properties (if exists) to dest as log4j.properties
-    if (serverLog4jPath != null) {
-      FileUtil.copy(srcFS, serverLog4jPath, destFS, new Path(destDirPath,
-          SliderKeys.LOG4J_PROP_FILENAME), false, true, conf);
-    }
+    FileUtil.copy(srcFS, sourcePaths, destFS, destDirPath, false, true, conf);
     return srcFileCount;
   }