Log4j 1.0.4

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.


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, disable, instanceFQN, myContext, 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 the value of suffix variable to each 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()
          Retuns the option names for this component, namely the string SUFFIX_OPTION.
 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.
 
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, getInstance, 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

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 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.

getOptionStrings

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

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

trace

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

Log4j 1.0.4

Please notify me about new log4j releases.