Home » apache-log4j-1.2.16 » org.apache » log4j » [javadoc | source]
org.apache.log4j
public class: Logger [javadoc | source]
java.lang.Object
   org.apache.log4j.Category
      org.apache.log4j.Logger

All Implemented Interfaces:
    AppenderAttachable

Direct Known Subclasses:
    MyLogger, RootLogger, NOPLogger, RootCategory

This is the central class in the log4j package. Most logging operations, except configuration, are done through this class.
Fields inherited from org.apache.log4j.Category:
name,  level,  parent,  resourceBundle,  repository,  aai,  additive
Constructor:
 protected Logger(String name) 
Method from org.apache.log4j.Logger Summary:
getLogger,   getLogger,   getLogger,   getRootLogger,   isTraceEnabled,   trace,   trace
Methods from org.apache.log4j.Category:
addAppender,   assertLog,   callAppenders,   closeNestedAppenders,   debug,   debug,   error,   error,   exists,   fatal,   fatal,   forcedLog,   getAdditivity,   getAllAppenders,   getAppender,   getChainedPriority,   getCurrentCategories,   getDefaultHierarchy,   getEffectiveLevel,   getHierarchy,   getInstance,   getInstance,   getLevel,   getLoggerRepository,   getName,   getParent,   getPriority,   getResourceBundle,   getResourceBundleString,   getRoot,   info,   info,   isAttached,   isDebugEnabled,   isEnabledFor,   isInfoEnabled,   l7dlog,   l7dlog,   log,   log,   log,   removeAllAppenders,   removeAppender,   removeAppender,   setAdditivity,   setHierarchy,   setLevel,   setPriority,   setResourceBundle,   shutdown,   warn,   warn
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.log4j.Logger Detail:
 public static Logger getLogger(String name) 
    Retrieve a logger named according to the value of the name parameter. If the named logger already exists, then the existing instance will be returned. Otherwise, a new instance is created.

    By default, loggers do not have a set level but inherit it from their neareast ancestor with a set level. This is one of the central features of log4j.

 public static Logger getLogger(Class clazz) 
    Shorthand for getLogger(clazz.getName()).
 public static Logger getLogger(String name,
    LoggerFactory factory) 
 public static Logger getRootLogger() 
    Return the root logger for the current logger repository.

    The Logger.getName() method for the root logger always returns stirng value: "root". However, calling Logger.getLogger("root") does not retrieve the root logger but a logger just under root named "root".

    In other words, calling this method is the only way to retrieve the root logger.

 public boolean isTraceEnabled() 
    Check whether this category is enabled for the TRACE Level.
 public  void trace(Object message) 
    Log a message object with the TRACE level.
 public  void trace(Object message,
    Throwable t) 
    Log a message object with the TRACE level including the stack trace of the Throwable t passed as parameter.

    See #debug(Object) form for more detailed information.