org.log4j.examples
Class MyCategory
java.lang.Object
|
+--org.log4j.Category
|
+--org.log4j.examples.MyCategory
- All Implemented Interfaces:
- AppenderAttachable
- public class MyCategory
- extends Category
A simple example showing Category sub-classing. It shows the
minimum steps necessary to implement one's CategoryFactory
and that sub-classes can follow the hiearchy
See source
code for more details.
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 |
MyCategory
public MyCategory(String name)
- Just calls the parent constuctor.
main
public static void main(String[] args)
- This program will just print
DEBUG [main] some.cat - Hello world.
and exit.
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
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.
Please notify me about new log4j releases.