This is an automated email from the ASF dual-hosted git repository.

klund pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/geode.git


The following commit(s) were added to refs/heads/develop by this push:
     new 6a9a98b  GEODE-5430: Allow disk store commands to use custom log4j2 
config
6a9a98b is described below

commit 6a9a98b0bae561407230c5354fc95af0eae49268
Author: Kirk Lund <[email protected]>
AuthorDate: Thu Jun 21 13:24:46 2018 -0700

    GEODE-5430: Allow disk store commands to use custom log4j2 config
    
    If you edit the gfsh script to specify a custom log4j2 xml
    configuration file, this change will propagate that custom
    config file to any forked disk store commands.
---
 .../internal/cli/commands/DiskStoreCommandsUtils.java    | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git 
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommandsUtils.java
 
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommandsUtils.java
index 14aedf9..a93d919 100644
--- 
a/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommandsUtils.java
+++ 
b/geode-core/src/main/java/org/apache/geode/management/internal/cli/commands/DiskStoreCommandsUtils.java
@@ -12,24 +12,31 @@
  * or implied. See the License for the specific language governing permissions 
and limitations under
  * the License.
  */
-
 package org.apache.geode.management.internal.cli.commands;
 
+import static 
org.apache.logging.log4j.core.config.ConfigurationFactory.CONFIGURATION_FILE_PROPERTY;
+
 import java.io.File;
 import java.net.URL;
 import java.util.List;
 import java.util.Set;
 
+import org.apache.commons.lang.StringUtils;
+
 import org.apache.geode.distributed.DistributedMember;
 import org.apache.geode.internal.cache.InternalCache;
 import org.apache.geode.internal.logging.LogService;
 import org.apache.geode.management.internal.cli.CliUtil;
 
 class DiskStoreCommandsUtils {
+
   static void configureLogging(final List<String> commandList) {
-    URL configUrl = LogService.class.getResource(LogService.CLI_CONFIG);
-    String configFilePropertyValue = configUrl.toString();
-    commandList.add("-Dlog4j.configurationFile=" + configFilePropertyValue);
+    String configFilePropertyValue = 
System.getProperty(CONFIGURATION_FILE_PROPERTY);
+    if (StringUtils.isBlank(configFilePropertyValue)) {
+      URL configUrl = LogService.class.getResource(LogService.CLI_CONFIG);
+      configFilePropertyValue = configUrl.toString();
+    }
+    commandList.add("-D" + CONFIGURATION_FILE_PROPERTY + "=" + 
configFilePropertyValue);
   }
 
   static String validatedDirectories(String[] diskDirs) {
@@ -54,7 +61,6 @@ class DiskStoreCommandsUtils {
   }
 
   static Set<DistributedMember> getNormalMembers(final InternalCache cache) {
-    // TODO determine what this does (as it is untested and unmockable!)
     return CliUtil.getAllNormalMembers(cache);
   }
 }

Reply via email to