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.
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 |
MyCategory
public MyCategory(String name)
- Just calls the parent constuctor.
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.
Please notify me about new log4j releases.