|
Log4j 1.1b7 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.log4j.Category | +--org.apache.log4j.xml.examples.XCategory
A simple example showing Category sub-classing. It shows the
minimum steps necessary to implement one's CategoryFactory
.
Note that sub-classes follow the hiearchy even if its categories
belong to different classes.
See source code for more details. See also extension1.xml and extension2.xml XML configuration files.
Inner Class Summary | |
static class |
XCategory.XFactory
|
Field Summary | |
static String |
SUFFIX_OPTION
|
Fields inherited from class org.apache.log4j.Category |
additive, DEFAULT_CONFIGURATION_FILE, DEFAULT_CONFIGURATION_KEY, DEFAULT_INIT_OVERRIDE_KEY, defaultHierarchy, hierarchy, name, parent, priority, resourceBundle |
Constructor Summary | |
protected |
XCategory(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 Category |
getInstance(Class clazz)
This method overrides Category.getInstance(Class) by supplying
its own factory type as a parameter. |
static Category |
getInstance(String name)
This method overrides Category.getInstance(java.lang.String) by supplying
its own factory type as a parameter. |
String |
getOption(String option)
|
String[] |
getOptionStrings()
Retuns the option names for this component, namely the string SUFFIX_OPTION . |
void |
lethal(String message)
We introduce a new printing method in order to support XPriority.LETHAL . |
void |
lethal(String message,
Throwable t)
We introduce a new printing method in order to support XPriority.LETHAL . |
void |
setOption(String option,
String value)
Set XCategory specific options. |
void |
trace(String message)
We introduce a new printing method that takes the TRACE priority. |
void |
trace(String message,
Throwable t)
We introduce a new printing method that takes the TRACE priority. |
Methods inherited from class org.apache.log4j.Category |
addAppender, assert, callAppenders, debug, debug, error, error, exists, fatal, fatal, forcedLog, getAdditivity, getAllAppenders, getAppender, getChainedPriority, getCurrentCategories, getDefaultHierarchy, getHierarchy, getInstance, getName, getPriority, getResourceBundle, getResourceBundleString, getRoot, info, info, isDebugEnabled, isEnabledFor, isInfoEnabled, l7dlog, l7dlog, log, log, log, removeAllAppenders, removeAppender, removeAppender, setAdditivity, setPriority, setResourceBundle, shutdown, warn, warn |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final String SUFFIX_OPTION
Constructor Detail |
protected XCategory(String name)
Method Detail |
public void activateOptions()
activateOptions
in interface OptionHandler
public void debug(String message)
public static Category getInstance(String name)
Category.getInstance(java.lang.String)
by supplying
its own factory type as a parameter.org.apache.log4j.Category
name
- The name of the category to retrieve.public static Category getInstance(Class clazz)
Category.getInstance(Class)
by supplying
its own factory type as a parameter.org.apache.log4j.Category
clazz
- The name of clazz
will be used as the
name of the category to retrieve. See Category.getInstance(String)
for more detailed information.public String[] getOptionStrings()
SUFFIX_OPTION
.getOptionStrings
in interface OptionHandler
public void lethal(String message, Throwable t)
XPriority.LETHAL
.public void lethal(String message)
XPriority.LETHAL
.public void setOption(String option, String value)
The Suffix option is the only recognized option. It takes a string value.
setOption
in interface OptionHandler
public String getOption(String option)
public void trace(String message, Throwable t)
public void trace(String message)
|
Log4j 1.1b7 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |