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.
Constructor Summary |
protected |
XLogger(String name)
Just calls the parent constuctor. |
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 |
XLogger
protected XLogger(String name)
- Just calls the parent constuctor.
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.
Copyright 2000-2002 Apache Software Foundation.