Github user anmolnar commented on a diff in the pull request:

    https://github.com/apache/zookeeper/pull/561#discussion_r201620682
  
    --- Diff: src/java/main/org/apache/zookeeper/jmx/MBeanRegistry.java ---
    @@ -124,9 +124,7 @@ private void unregister(String path,ZKMBeanInfo bean) 
throws JMException  {
                 return;
             if (!bean.isHidden()) {
                 final ObjectName objName = makeObjectName(path, bean);
    -            if (LOG.isInfoEnabled()) {
    -                LOG.info("Unregister MBean [{}]", objName);
    -            }
    +            LOG.debug("Unregister MBean [{}]", objName);
    --- End diff --
    
    Right. And this where using log4j message formatter comes important: if one 
use `string.format()` instead and not putting it inside an if block, the string 
will be formatted every time no matter if the log level is enabled.


---

Reply via email to