Uploaded image for project: 'ActiveMQ Classic'
  1. ActiveMQ Classic
  2. AMQ-2845

log4j conf reload via jmx ignores log4j.configuration setting

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 5.3.2
    • 5.6.0
    • Broker
    • None
    • N/A

    • Patch Available

    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"); + }

        +
        if (log4jprops != null) {
        Class propertyConfiguratorClass = cl.loadClass("org.apache.log4j.PropertyConfigurator");
        Method configure = propertyConfiguratorClass.getMethod("configure", new Class[]

        {URL.class}

        );

      Attachments

        Activity

          People

            Unassigned Unassigned
            zpg ZP Gu
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: