powered by Jive Software

Question regarding the logging

Hi,

I took a look at the loggingmechnism openfire uses and I found this:

Log.java:

public static void debug(String s) {
  if (isDebugEnabled()) {
    debugLog.debug(s);
  }
} [...] debugEnabled = "true".equals(JiveGlobals.getXMLProperty("log.debug.enabled")); [...] public static boolean isDebugEnabled() {
  return debugEnabled;
}

Because of

private static final Logger debugLog = Hierarchy.getDefaultHierarchy().getLoggerFor("Jive-DEBUG");

this calls:

Logger.java:

/**
* Log a debug priority event.
*
* @param message the message
*/
public final void debug(final String message) {
  if (isDebugEnabled()) {
    output(Priority.DEBUG, message, null);
  }
}

Why is the method isDebugEnabled called twice?

Shure, this isn’'t muich time wich is wasted, but I cannot see the reason.

Maybe because a plugin developed by someone might call the function directly and forget to check the variable? Otherwise, some plugins do dewbug logging, while the rest doesn’'t. Consistency perhaps.