Log4j 1.1.3

org.apache.log4j.xml.examples
Class XCategory

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

public class XCategory
extends Category
implements OptionHandler

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

SUFFIX_OPTION

public static final String SUFFIX_OPTION
Constructor Detail

XCategory

protected XCategory(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.

getInstance

public static Category getInstance(String name)
This method overrides Category.getInstance(java.lang.String) by supplying its own factory type as a parameter.
Following copied from class: org.apache.log4j.Category
Parameters:
name - The name of the category to retrieve.

getInstance

public static Category getInstance(Class clazz)
This method overrides Category.getInstance(Class) by supplying its own factory type as a parameter.
Following copied from class: org.apache.log4j.Category
Parameters:
clazz - The name of clazz will be used as the name of the category to retrieve. See Category.getInstance(String) for more detailed information.

getOptionStrings

public String[] getOptionStrings()
Retuns the option names for this component, namely the string SUFFIX_OPTION.
Specified by:
getOptionStrings in interface OptionHandler

lethal

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

lethal

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

setOption

public void setOption(String option,
                      String value)
Set XCategory specific options.

The Suffix option is the only recognized option. It takes a string value.

Specified by:
setOption in interface OptionHandler

getOption

public String getOption(String option)

trace

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

trace

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

Log4j 1.1.3

Please notify me about new log4j releases.