Log4j 1.2beta3

org.apache.log4j.xml.examples
Class XLogger

java.lang.Object
  |
  +--org.apache.log4j.Category
        |
        +--org.apache.log4j.Logger
              |
              +--org.apache.log4j.xml.examples.XLogger
All Implemented Interfaces:
AppenderAttachable, OptionHandler

public class XLogger
extends Logger
implements OptionHandler

A simple example showing Logger sub-classing. It shows the minimum steps necessary to implement one's LoggerFactory. Note that sub-classes follow the hiearchy even if its loggers belong to different classes.


Inner Class Summary
static class XLogger.XFactory
           
 
Fields inherited from class org.apache.log4j.Category
additive, level, name, parent, repository, resourceBundle
 
Constructor Summary
protected XLogger(String name)
          Just calls the parent constuctor.
 
Method Summary
 void activateOptions()
          Nothing to activate.
 void debug(String message)
          Overrides the standard debug method by appending the value of suffix variable to each message.
static Logger getLogger(Class clazz)
          Same as calling getLogger(clazz.getName()).
static Logger getLogger(String name)
          Retrieve a logger by name.
 String getSuffix()
           
 void lethal(String message)
          We introduce a new printing method in order to support XLevel.LETHAL.
 void lethal(String message, Throwable t)
          We introduce a new printing method in order to support XLevel.LETHAL.
 void setSuffix(String suffix)
           
 void trace(String message)
          We introduce a new printing method that takes the TRACE level.
 void trace(String message, Throwable t)
          We introduce a new printing method that takes the TRACE level.
 
Methods inherited from class org.apache.log4j.Logger
getLogger, getRootLogger
 
Methods inherited from class org.apache.log4j.Category
addAppender, assertLog, callAppenders, debug, debug, error, error, exists, fatal, fatal, forcedLog, getAdditivity, getAllAppenders, getAppender, getChainedLevel, getCurrentCategories, getDefaultHierarchy, 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, setLevel, setPriority, setResourceBundle, shutdown, warn, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XLogger

protected XLogger(String name)
Just calls the parent constuctor.
Method Detail

activateOptions

public void activateOptions()
Nothing to activate.
Specified by:
activateOptions in interface OptionHandler

debug

public void debug(String message)
Overrides the standard debug method by appending the value of suffix variable to each message.

lethal

public void lethal(String message,
                   Throwable t)
We introduce a new printing method in order to support XLevel.LETHAL.

lethal

public void lethal(String message)
We introduce a new printing method in order to support XLevel.LETHAL.

getLogger

public static Logger getLogger(String name)
Description copied from class: Logger
Retrieve a logger by name.

getLogger

public static Logger getLogger(Class clazz)
Description copied from class: Logger
Same as calling getLogger(clazz.getName()).

getSuffix

public String getSuffix()

setSuffix

public void setSuffix(String suffix)

trace

public void trace(String message,
                  Throwable t)
We introduce a new printing method that takes the TRACE level.

trace

public void trace(String message)
We introduce a new printing method that takes the TRACE level.

Log4j 1.2beta3

Copyright 2000-2002 Apache Software Foundation.