You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@uima.apache.org by bu...@apache.org on 2015/04/22 15:17:24 UTC
svn commit: r1675355 -
/uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/DuccLogger.java
Author: burn
Date: Wed Apr 22 13:17:23 2015
New Revision: 1675355
URL: http://svn.apache.org/r1675355
Log:
UIMA-4359 Set the log4j config file explicitly to avoid the strange default seacrch
Modified:
uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/DuccLogger.java
Modified: uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/DuccLogger.java
URL: http://svn.apache.org/viewvc/uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/DuccLogger.java?rev=1675355&r1=1675354&r2=1675355&view=diff
==============================================================================
--- uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/DuccLogger.java (original)
+++ uima/sandbox/uima-ducc/trunk/uima-ducc-common/src/main/java/org/apache/uima/ducc/common/utils/DuccLogger.java Wed Apr 22 13:17:23 2015
@@ -18,6 +18,8 @@
*/
package org.apache.uima.ducc.common.utils;
+import java.io.File;
+import java.net.URLClassLoader;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
@@ -148,7 +150,16 @@ public class DuccLogger
System.out.println("WARNING: Cannot find system property DUCC_HOME to configure ducc logger. Using default log4j configurator.");
} else {
if ( ! watchdogStarted ) {
- DOMConfigurator.configureAndWatch(System.getProperty("DUCC_HOME") + "/resources/log4j.xml");
+ // Explicitly set the config file since the search for the default uses
+ // ClassLoader.getSystemResource() so may find one in the user's classpath
+ String configFile = System.getProperty("DUCC_HOME") + "/resources/log4j.xml";
+ String usersValue = System.setProperty("log4j.configuration", "file:" + configFile);
+ DOMConfigurator.configureAndWatch(configFile);
+ if (usersValue == null) {
+ System.clearProperty("log4j.configuration");
+ } else {
+ System.setProperty("log4j.configuration", usersValue);
+ }
watchdogStarted = true;
}
}