zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asdf2014 <...@git.apache.org>
Subject [GitHub] zookeeper pull request #294: ZOOKEEPER-2822: Wrong `ObjectName` about `MBean...
Date Tue, 20 Nov 2018 11:07:22 GMT
Github user asdf2014 commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/294#discussion_r234959406
  
    --- Diff: zookeeper-server/src/main/java/org/apache/zookeeper/jmx/ManagedUtil.java ---
    @@ -69,9 +69,13 @@ public static void registerLog4jMBeans() throws JMException {
                 try {
                     // Create and Register the top level Log4J MBean
                     // org.apache.log4j.jmx.HierarchyDynamicMBean hdm = new org.apache.log4j.jmx.HierarchyDynamicMBean();
    -                Object hdm = Class.forName("org.apache.log4j.jmx.HierarchyDynamicMBean").getDeclaredConstructor().newInstance();
    +                Object hdm = Class.forName("org.apache.log4j.jmx.HierarchyDynamicMBean").getConstructor().newInstance();
     
    -                ObjectName mbo = new ObjectName("log4j:hiearchy=default");
    +                String mbean = System.getenv("zookeeper.jmx.log4j.mbean");
    --- End diff --
    
    > I would go for a system property
    
    FYI, `System.getenv()` is for Operating System environment variables, whereas `System.getProperty()`
is for JVM arguments which are passed as `-DpropName=value` to Java application launcher.
    
    So, maybe use `getenv()` would be more reasonable.


---

Mime
View raw message