Log4j 0.9.1

org.log4j.xml.examples
Class XCategory

java.lang.Object
  |
  +--org.log4j.Category
        |
        +--org.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.


Field Summary
static String SUFFIX_OPTION
           
 
Fields inherited from class org.log4j.Category
additive, DEFAULT_INIT_OVERRIDE_KEY, DEFAULT_PROPERTIES_FILE, disable, instanceFQN, name, parent, priority, resourceBundle
 
Constructor Summary
XCategory(String name)
          Just calls the parent constuctor.
 
Method Summary
 void activateOptions()
          Activate the options that were previously set with calls to setOption.
 void debug(String message)
          Overrides the standard debug method by appending " world" to each message.
 void fatal(String message)
           
static Category getInstance(String name)
          This method overrides Category.getInstance(java.lang.String) by supplying its own factory type as a parameter.
 String[] getOptionStrings()
          Return list of strings that the OptionHandler instance recognizes.
 void setOption(String option, String value)
          Set option to value.
 void trace(String message)
           
 
Methods inherited from class org.log4j.Category
addAppender, assert, callAppenders, debug, debug, error, error, error, exists, getAdditivity, getAllAppenders, getAppender, getChainedPriority, getCurrentCategories, getInstance, getName, getPriority, getResourceBundle, getResourceBundleString, getRoot, getRootPriority, info, info, info, isDebugEnabled, isEnabledFor, isInfoEnabled, l7dlog, l7dlog, log, log, log, removeAllAppenders, removeAppender, removeAppender, setAdditivity, setPriority, setResourceBundle, setRootPriority, warn, 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

public XCategory(String name)
Just calls the parent constuctor.
Method Detail

activateOptions

public void activateOptions()
Description copied from interface: OptionHandler
Activate the options that were previously set with calls to setOption.

This allows to defer activiation of the options until all options have been set. This is required for components which have related options that remain ambigous until all are set.

For example, the FileAppender has the "File" and "Append" options both of which are ambigous until the other is also set.

Specified by:
activateOptions in interface OptionHandler

debug

public void debug(String message)
Overrides the standard debug method by appending " world" to each message.
Overrides:
debug in class Category
Following copied from class: org.log4j.Category
Parameters:
message - string to write in the log file

fatal

public void fatal(String 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.log4j.Category
Parameters:
name - The name of the category to retrieve.

getOptionStrings

public String[] getOptionStrings()
Description copied from interface: OptionHandler
Return list of strings that the OptionHandler instance recognizes.
Specified by:
getOptionStrings in interface OptionHandler

setOption

public void setOption(String option,
                      String value)
Description copied from interface: OptionHandler
Set option to value.

The handling of each option depends on the OptionHandler instance. Some options may become active immediately whereas other may be activated only when OptionHandler.activateOptions() is called.

Specified by:
setOption in interface OptionHandler

trace

public void trace(String message)

Log4j 0.9.1

Please notify me about new log4j releases.