NLOG4J 1.2.24

org.apache.log4j
Class Logger

java.lang.Object
  extended by org.slf4j.impl.MarkerIgnoringBase
      extended by org.apache.log4j.Category
          extended by org.apache.log4j.Logger
All Implemented Interfaces:
AppenderAttachable, Logger
Direct Known Subclasses:
RootCategory, RootLogger

public class Logger
extends Category
implements Logger

This is the central class in the log4j package. Most logging operations, except configuration, are done through this class.

Since:
log4j 1.2
Author:
Ceki Gülcü

Field Summary
 
Fields inherited from class org.apache.log4j.Category
additive, level, name, parent, repository, resourceBundle
 
Constructor Summary
protected Logger(String name)
           
 
Method Summary
static Logger getLogger(Class clazz)
          Shorthand for getLogger(clazz.getName()).
static Logger getLogger(String name)
          Retrieve a logger named according to the value of the name parameter.
static Logger getLogger(String name, LoggerFactory factory)
          Like getLogger(String) except that the type of logger instantiated depends on the type returned by the LoggerFactory.makeNewLoggerInstance(java.lang.String) method of the factory parameter.
static Logger getRootLogger()
          Return the root logger for the current logger repository.
 
Methods inherited from class org.apache.log4j.Category
addAppender, assertLog, callAppenders, debug, debug, debug, debug, debug, debug, error, error, error, error, error, error, exists, fatal, fatal, fatal, forcedLog, getAdditivity, getAllAppenders, getAppender, getChainedPriority, getCurrentCategories, getDefaultHierarchy, getEffectiveLevel, getHierarchy, getInstance, getInstance, getLevel, getLoggerRepository, getName, getParent, getPriority, getResourceBundle, getResourceBundleString, getRoot, info, info, info, info, info, info, isAttached, isDebugEnabled, isEnabledFor, isErrorEnabled, isInfoEnabled, isWarnEnabled, l7dlog, l7dlog, log, log, log, removeAllAppenders, removeAppender, removeAppender, setAdditivity, setLevel, setPriority, setResourceBundle, shutdown, warn, warn, warn, warn, warn, warn
 
Methods inherited from class org.slf4j.impl.MarkerIgnoringBase
debug, debug, debug, debug, debug, error, error, error, error, error, info, info, info, info, info, isDebugEnabled, isErrorEnabled, isInfoEnabled, isWarnEnabled, warn, warn, warn, warn, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.slf4j.Logger
debug, debug, debug, debug, debug, debug, debug, debug, debug, debug, error, error, error, error, error, error, error, error, error, error, getName, info, info, info, info, info, info, info, info, info, info, isDebugEnabled, isDebugEnabled, isErrorEnabled, isErrorEnabled, isInfoEnabled, isInfoEnabled, isWarnEnabled, isWarnEnabled, warn, warn, warn, warn, warn, warn, warn, warn, warn, warn
 

Constructor Detail

Logger

protected Logger(String name)
Method Detail

getLogger

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.

Parameters:
name - The name of the logger to retrieve.

getLogger

public static Logger getLogger(Class clazz)
Shorthand for getLogger(clazz.getName()).

Parameters:
clazz - The name of clazz will be used as the name of the logger to retrieve. See getLogger(String) for more detailed information.

getRootLogger

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.


getLogger

public static Logger getLogger(String name,
                               LoggerFactory factory)
Like getLogger(String) except that the type of logger instantiated depends on the type returned by the LoggerFactory.makeNewLoggerInstance(java.lang.String) method of the factory parameter.

This method is intended to be used by sub-classes.

Parameters:
name - The name of the logger to retrieve.
factory - A LoggerFactory implementation that will actually create a new Instance.
Since:
0.8.5

NLOG4J 1.2.24

Copyright 2000-2005 Apache Software Foundation.