Log4j 1.1b7

org.apache.log4j.examples
Class MyCategory

java.lang.Object
  |
  +--org.apache.log4j.Category
        |
        +--org.apache.log4j.examples.MyCategory
All Implemented Interfaces:
AppenderAttachable

public class MyCategory
extends Category

A simple example showing category subclassing.

The example should make it clear that subclasses follow the hierarchy. You should also try running this example with a bad and good configuration file samples.

See source code for more details.


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
MyCategory(String name)
          Just calls the parent constuctor.
 
Method Summary
 void debug(String message)
          Overrides the standard debug method by appending " world" at the end of each message.
static Category getInstance(String name)
          This method overrides Category.getInstance(java.lang.String) by supplying its own factory type as a parameter.
static void main(String[] args)
          When called wihtout arguments, this program will just print DEBUG [main] some.cat - Hello world.
 
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, 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
 

Constructor Detail

MyCategory

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

main

public static void main(String[] args)
When called wihtout arguments, this program will just print
DEBUG [main] some.cat - Hello world.
and exit. However, it can be called with a configuration file in XML or properties format.

debug

public void debug(String message)
Overrides the standard debug method by appending " world" at the end of 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.

Log4j 1.1b7

Please notify me about new log4j releases.