diff --git a/console-proxy/.classpath b/console-proxy/.classpath
index 3bd35a506ef..5a34eae6642 100644
--- a/console-proxy/.classpath
+++ b/console-proxy/.classpath
@@ -1,9 +1,9 @@
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/console-viewer/.classpath b/console-viewer/.classpath
index 19542e73fc0..e8a8d8c0a84 100644
--- a/console-viewer/.classpath
+++ b/console-viewer/.classpath
@@ -1,7 +1,7 @@
-
-
-
-
-
-
-
+
+
+
+
+
+
+
diff --git a/utils/src/com/cloud/utils/component/ComponentLocator.java b/utils/src/com/cloud/utils/component/ComponentLocator.java
index f447e0f7bea..7f7abc24f69 100755
--- a/utils/src/com/cloud/utils/component/ComponentLocator.java
+++ b/utils/src/com/cloud/utils/component/ComponentLocator.java
@@ -82,6 +82,7 @@ public class ComponentLocator implements ComponentLocatorMBean {
protected static final Callback[] s_callbacks = new Callback[] { NoOp.INSTANCE, new DatabaseCallback() };
protected static final CallbackFilter s_callbackFilter = new DatabaseCallbackFilter();
protected static final HashMap, InjectInfo> s_factories = new HashMap, InjectInfo>();
+ protected static Boolean s_once = false;
protected HashMap> _adapterMap;
protected HashMap> _managerMap;
@@ -91,17 +92,6 @@ public class ComponentLocator implements ComponentLocatorMBean {
protected Object _component;
static {
- File file = PropertiesUtil.findConfigFile("log4j-cloud.xml");
- if (file != null) {
- s_logger.info("log4j configuration found at " + file.getAbsolutePath());
- DOMConfigurator.configureAndWatch(file.getAbsolutePath());
- } else {
- file = PropertiesUtil.findConfigFile("log4j-cloud.properties");
- if (file != null) {
- s_logger.info("log4j configuration found at " + file.getAbsolutePath());
- PropertyConfigurator.configureAndWatch(file.getAbsolutePath());
- }
- }
Runtime.getRuntime().addShutdownHook(new CleanupThread());
}
@@ -679,7 +669,24 @@ public class ComponentLocator implements ComponentLocatorMBean {
return new Adapters(key, new ArrayList>());
}
- protected static ComponentLocator getLocatorInternal(String server, boolean setInThreadLocal, String configFileName) {
+ protected static ComponentLocator getLocatorInternal(String server, boolean setInThreadLocal, String configFileName, String log4jFilename) {
+ synchronized(s_once) {
+ if (!s_once) {
+ File file = PropertiesUtil.findConfigFile(log4jFilename + ".xml");
+ if (file != null) {
+ s_logger.info("log4j configuration found at " + file.getAbsolutePath());
+ DOMConfigurator.configureAndWatch(file.getAbsolutePath());
+ } else {
+ file = PropertiesUtil.findConfigFile(log4jFilename + ".properties");
+ if (file != null) {
+ s_logger.info("log4j configuration found at " + file.getAbsolutePath());
+ PropertyConfigurator.configureAndWatch(file.getAbsolutePath());
+ }
+ }
+ s_once = true;
+ }
+ }
+
ComponentLocator locator;
synchronized (s_locators) {
locator = s_locators.get(server);
@@ -700,8 +707,8 @@ public class ComponentLocator implements ComponentLocatorMBean {
return locator;
}
- public static ComponentLocator getLocator(String server, String configFileName) {
- return getLocatorInternal(server, true, configFileName);
+ public static ComponentLocator getLocator(String server, String configFileName, String log4jFilename) {
+ return getLocatorInternal(server, true, configFileName, log4jFilename);
}
public static ComponentLocator getLocator(String server) {
@@ -713,7 +720,7 @@ public class ComponentLocator implements ComponentLocatorMBean {
configFile = "components.xml";
}
}
- return getLocatorInternal(server, true, configFile);
+ return getLocatorInternal(server, true, configFile, "log4j-cloud");
}
public static ComponentLocator getCurrentLocator() {
diff --git a/utils/src/com/cloud/utils/testcase/ComponentTestCase.java b/utils/src/com/cloud/utils/testcase/ComponentTestCase.java
index fa2b307369a..dbe8ea322bc 100644
--- a/utils/src/com/cloud/utils/testcase/ComponentTestCase.java
+++ b/utils/src/com/cloud/utils/testcase/ComponentTestCase.java
@@ -33,7 +33,8 @@ public class ComponentTestCase extends Log4jEnabledTestCase {
if(annotation instanceof ComponentSetup) {
ComponentLocator.getLocator(
((ComponentSetup)annotation).managerName(),
- ((ComponentSetup)annotation).setupXml()
+ ((ComponentSetup)annotation).setupXml(),
+ ((ComponentSetup)annotation).log4j()
);
break;