Details
Description
If you start your AMQ with log4j.configuration setting (via -D command line, for example), and then reload log4j via mbean with BrokerView.java::reloadLog4jProperties(), the log4j.configuration is ignored, and it went straight to searching for log4j.properties.
Here's diff for the fix:
— BrokerView.java.ORIG 2010-04-26 17:57:20.000000000 -0400
+++ BrokerView.java 2010-07-20 09:14:31.000000000 -0400
@@ -23,6 +23,7 @@
import java.net.URI;
import java.net.URL;
import java.util.concurrent.atomic.AtomicInteger;
+import java.net.MalformedURLException;
import javax.management.ObjectName;
@@ -321,8 +322,19 @@
Method resetConfiguration = logManagerClass.getMethod("resetConfiguration", new Class[]{});
resetConfiguration.invoke(null, new Object[]{});
- URL log4jprops = cl.getResource("log4j.properties");
+
+ String configurationOptionStr = System.getProperty("log4j.configuration");
+ URL log4jprops = null;
+ if (configurationOptionStr != null)Unknown macro: {+ try { + log4jprops = new URL(configurationOptionStr); + } catch (MalformedURLException ex) { + log4jprops = cl.getResource("log4j.properties"); + }+ }else
{ + log4jprops = cl.getResource("log4j.properties"); + }+
{URL.class}
if (log4jprops != null) {
Class propertyConfiguratorClass = cl.loadClass("org.apache.log4j.PropertyConfigurator");
Method configure = propertyConfiguratorClass.getMethod("configure", new Class[]);