FileDocCategorySizeDatePackage
LogLog.javaAPI DocApache log4j 1.2.155053Sat Aug 25 00:09:40 BST 2007org.apache.log4j.helpers

LogLog

public class LogLog extends Object
This class used to output log statements from within the log4j package.

Log4j components cannot make log4j logging calls. However, it is sometimes useful for the user to learn about what log4j is doing. You can enable log4j internal logging by defining the log4j.configDebug variable.

All log4j internal debug calls go to System.out where as internal error messages are sent to System.err. All internal messages are prepended with the string "log4j: ".

since
0.8.2
author
Ceki Gülcü

Fields Summary
public static final String
DEBUG_KEY
Defining this value makes log4j print log4j-internal debug statements to System.out.

The value of this string is log4j.debug.

Note that the search for all option names is case sensitive.

public static final String
CONFIG_DEBUG_KEY
Defining this value makes log4j components print log4j-internal debug statements to System.out.

The value of this string is log4j.configDebug.

Note that the search for all option names is case sensitive.

protected static boolean
debugEnabled
private static boolean
quietMode
In quietMode not even errors generate any output.
private static final String
PREFIX
private static final String
ERR_PREFIX
private static final String
WARN_PREFIX
Constructors Summary
Methods Summary
public static voiddebug(java.lang.String msg)
This method is used to output log4j internal debug statements. Output goes to System.out.

    if(debugEnabled && !quietMode) {
      System.out.println(PREFIX+msg);
    }
  
public static voiddebug(java.lang.String msg, java.lang.Throwable t)
This method is used to output log4j internal debug statements. Output goes to System.out.

    if(debugEnabled && !quietMode) {
      System.out.println(PREFIX+msg);
      if(t != null)
	t.printStackTrace(System.out);
    }
  
public static voiderror(java.lang.String msg)
This method is used to output log4j internal error statements. There is no way to disable error statements. Output goes to System.err.

    if(quietMode)
      return;
    System.err.println(ERR_PREFIX+msg);
  
public static voiderror(java.lang.String msg, java.lang.Throwable t)
This method is used to output log4j internal error statements. There is no way to disable error statements. Output goes to System.err.

    if(quietMode)
      return;

    System.err.println(ERR_PREFIX+msg);
    if(t != null) {
      t.printStackTrace();
    }
  
public static voidsetInternalDebugging(boolean enabled)
Allows to enable/disable log4j internal logging.


   
    String key = OptionConverter.getSystemProperty(DEBUG_KEY, null);

    if(key == null) {
      key = OptionConverter.getSystemProperty(CONFIG_DEBUG_KEY, null);
    }

    if(key != null) { 
      debugEnabled = OptionConverter.toBoolean(key, true);
    }
  
    debugEnabled = enabled;
  
public static voidsetQuietMode(boolean quietMode)
In quite mode no LogLog generates strictly no output, not even for errors.

param
quietMode A true for not

    LogLog.quietMode = quietMode;
  
public static voidwarn(java.lang.String msg)
This method is used to output log4j internal warning statements. There is no way to disable warning statements. Output goes to System.err.

    if(quietMode)
      return;

    System.err.println(WARN_PREFIX+msg);
  
public static voidwarn(java.lang.String msg, java.lang.Throwable t)
This method is used to output log4j internal warnings. There is no way to disable warning statements. Output goes to System.err.

    if(quietMode)
      return;

    System.err.println(WARN_PREFIX+msg);
    if(t != null) {
      t.printStackTrace();
    }