|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.log4j.Category
org.opennms.core.utils.ThreadCategory
This class is designed to work with log4j based on threads and not class names. This allows all the classes invoked by a thread to log their messages to the same location. This is particularly useful when messages from share common code should be associated with a higher level service or application.
Field Summary | |
private static java.lang.InheritableThreadLocal |
m_tgCategory
This thread local variable is used to store the category that threads (and their children) should use to log information. |
Fields inherited from class org.apache.log4j.Category |
additive, level, name, parent, repository, resourceBundle |
Constructor Summary | |
protected |
ThreadCategory(java.lang.String name)
This constructor created a new Category instance and sets its name. |
Method Summary | |
static org.apache.log4j.Category |
getInstance()
This method is used to get the category instance associated with the thread. |
static org.apache.log4j.Category |
getInstance(java.lang.Class c)
This method is used to get the category instance associated with the thread. |
static org.apache.log4j.Category |
getInstance(java.lang.String cname)
This method is used to get the category instance associated with the thread. |
static java.lang.String |
getPrefix()
This is used to retreive the current prefix as it has been inhereited by the calling thread. |
static void |
setPrefix(java.lang.String prefix)
This method is used to set a prefix for the category name that is used for all category instances in this thread. |
Methods inherited from class org.apache.log4j.Category |
addAppender, assertLog, callAppenders, debug, debug, error, error, exists, fatal, fatal, forcedLog, getAdditivity, getAllAppenders, getAppender, getChainedPriority, getCurrentCategories, getDefaultHierarchy, getEffectiveLevel, getHierarchy, getLevel, getLoggerRepository, getName, getParent, getPriority, getResourceBundle, getResourceBundleString, getRoot, info, info, isAttached, isDebugEnabled, isEnabledFor, isInfoEnabled, l7dlog, l7dlog, log, log, log, removeAllAppenders, removeAppender, removeAppender, setAdditivity, setLevel, 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 |
private static java.lang.InheritableThreadLocal m_tgCategory
Constructor Detail |
protected ThreadCategory(java.lang.String name)
name
- The name of the categoryMethod Detail |
public static org.apache.log4j.Category getInstance(java.lang.Class c)
c
- The class used to find the category if it was not set.
InheritableThreadLocal
public static org.apache.log4j.Category getInstance(java.lang.String cname)
cname
- The name used to find the category if it was not set.
InheritableThreadLocal
public static org.apache.log4j.Category getInstance()
InheritableThreadLocal
public static void setPrefix(java.lang.String prefix)
public static java.lang.String getPrefix()
RunnableConsumerThreadPool
to ensure that all the
internal threads run in the same category.
|
OpenNMS API 1.2.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |