powered by Jive Software

Question regarding the logging


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


public static void debug(String s) {
  if (isDebugEnabled()) {
} [...] 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:


* 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.