|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.log4j.Category
org.apache.log4j.Logger
com.bea.logging.LogCategory
Class LogCategory is the Logging Framework's base Class for logging. It extends the Logger class of the underlying implementation. It implements two interfaces: ILogger is the public interface to the logging facility. It is returned by the LogManager (c_categoryFactory) to clients wishing to log messages. The INestedDiagnosticContext interface simply exposes the methods of the underlying NDC class, without modifying their behavior.
Nested Class Summary | |
static class |
LogCategory.LogCategoryFactory
A factory for LogCategory instances. |
Field Summary | |
static LogCategory.LogCategoryFactory |
c_categoryFactory
|
Fields inherited from class org.apache.log4j.Category |
additive, level, name, parent, repository, resourceBundle |
Constructor Summary | |
LogCategory(String strContext)
Create a new logging category |
Method Summary | |
void |
addRuntimeDestination(PrintWriter writer)
Add a new destination at runtime. |
void |
audit(String strKey)
Log a message with the audit priority using the strKey for message lookup. |
void |
audit(String message,
boolean isDirect)
Log a message with the audit priority. |
void |
audit(String strKey,
Object obj)
Convenience method which allows the useer to log an audit message with one argument to fill into the template. |
void |
audit(String strKey,
Object[] aInfo)
Log a message with the audit priority. |
void |
audit(Throwable exception)
Log a message with the audit priority. |
void |
clearNDC()
Clear any nested disgnostic information. |
Stack |
cloneNDCStack()
Clone the diagnostic context for the current thread. |
void |
debug(String strMessage)
Log a message with the debug priority. |
static void |
dumpCategories()
This method will print the configuration for all Categories in the current default hierarchy. |
void |
error(String strKey)
Log a message with the error priority. |
void |
error(String message,
boolean isDirect)
Log a message with the error priority. |
void |
error(String strKey,
Object obj)
Convenience method which allows the user to log an error message with one argument to fill into the template. |
void |
error(String strKey,
Object[] aInfo)
Log a message with the error priority. |
void |
error(Throwable exception)
Log a message with the error priority. |
protected String |
formatMessage(String strTemplateKey,
Object[] aObj,
boolean warnIfMissing)
formatMessage is used to format a pattern with arguments passed in a Object[] |
String |
getI18NMessage(String strKey)
getI18NMessage(String) can be called to retrieve an Internationalized message string from a resource bundle. |
String |
getI18NMessage(String strKey,
Object obj)
Another convenience method, which allows the user to pass a single argument for replacement in the message template, without having to create an Object[] |
String |
getI18NMessage(String strKey,
Object[] aInfo)
getI18NMessage(String, Object[]) can be called to retrieve an Internationalized message string from a resource bundle. |
static LogCategory |
getLogger(org.apache.log4j.Hierarchy hierarchy,
LogContext context,
ResourceBundle bundle)
This method is called by the LogManager to create an LogCategory instance. |
static org.apache.log4j.Logger |
getLogger(String name)
Overrides parent getLogger() using our own c_categoryFactory instance. |
protected String |
getLoggerInfo(org.apache.log4j.Logger c)
|
PrintWriter |
getLogWriter()
Returns a PrintWriter for writing to an appropriate location. |
String |
getNDC()
Used when printing the diagnostic context. |
int |
getNDCDepth()
Get the current nesting depth of this diagnostic context |
INestedDiagnosticContext |
getNDCInterface()
Method returns an interface to the static NDC methods that this object can access. |
String |
getProperty(String strKey)
Gets raw property from the resource bundle |
void |
info(String strKey)
Log a message with the info priority. |
void |
info(String message,
boolean isDirect)
Log a message with the INFO priority. |
void |
info(String strKey,
Object obj)
Convenience method which allows the user to log a warn message with one argument to fill into the template. |
void |
info(String strKey,
Object[] aInfo)
Log a message with the warn priority. |
void |
inheritNDC(Stack stack)
Inherit the diagnostic context of another thread. |
void |
popNDC()
Clients should call this method before leaving a diagnostic context. |
void |
pushNDC(String message)
Push new diagnostic context information for the current thread. |
void |
removeNDC()
Remove the diagnostic context for this thread |
void |
setLevel(String strPriority)
This method sets the current LogCategory's priority to one of the established levels. |
void |
setNDCMaxDepth(int depth)
Set maximum depth of this diagnostic context. |
void |
setPriority(int intPriority)
This method overrides the method in super. |
void |
setPriority(LogPriority priority)
This method overrides the method in super. |
void |
setPriority(String strPriority)
This method overrides the method in super. |
String |
toString()
|
void |
warn(String strKey)
Log a message with the warn priority. |
void |
warn(String message,
boolean isDirect)
Log a message with the warn priority. |
void |
warn(String strKey,
Object obj)
Convenience method which allows the user to log a warn message with one argument to fill into the template. |
void |
warn(String strKey,
Object[] aInfo)
Log a message with the warn priority. |
void |
warn(Throwable exception)
Log a message with the error priority. |
Methods inherited from class org.apache.log4j.Logger |
getLogger, getLogger, getRootLogger |
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, getInstance, getInstance, 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, wait, wait, wait |
Methods inherited from interface com.bea.logging.ILogger |
isDebugEnabled, isInfoEnabled, setResourceBundle |
Field Detail |
public static LogCategory.LogCategoryFactory c_categoryFactory
Constructor Detail |
public LogCategory(String strContext)
strContext
- - identifies the category to log messages to...Method Detail |
public static org.apache.log4j.Logger getLogger(String name)
public static LogCategory getLogger(org.apache.log4j.Hierarchy hierarchy, LogContext context, ResourceBundle bundle)
hierarchy
- - the category hierarchy to retrieve the LogCategory from;
hierarchies are maintained for each active locale.context
- is a LogContext object containing the name of the
LogCategorybundle
- - the message bundle for a log context; ResourceBundles are
managed by the LogManager.
public void addRuntimeDestination(PrintWriter writer)
addRuntimeDestination
in interface ILogger
writer
- - a new destination for log messagespublic PrintWriter getLogWriter()
ILogger
getLogWriter
in interface ILogger
public void setPriority(int intPriority)
setPriority
in interface ILogger
intPriority
- is an integer that represents a logging priority level.
See com.bea.logging.LogPriority
for a set of static int values to use.public void setLevel(String strPriority)
setLevel
in interface ILogger
strPriority
- is a String name for an existing priority level.public void setPriority(String strPriority)
setPriority
in interface ILogger
strPriority
- is a String name for an existing priority level.public void setPriority(LogPriority priority)
setPriority
in interface ILogger
priority
- is a LogPriority object, which is constructed
using one of the static int values in LogPriority
as its argument.public String getProperty(String strKey)
getProperty
in interface ILogger
strKey
- - specific key for the desired property.
public String getI18NMessage(String strKey)
getI18NMessage
in interface ILogger
strKey
- is a String key for lookup of a message in a ResourceBundle
public String getI18NMessage(String strKey, Object[] aInfo)
getI18NMessage
in interface ILogger
strKey
- is a String key for lookup of a message in a ResourceBundleaInfo
- is an Object[] of parameters to be replaced in the template
returned by the key, strKey.
public String getI18NMessage(String strKey, Object obj)
getI18NMessage
in interface ILogger
strKey
- is a String key for lookup of a message in a ResourceBundleobj
- is typically a String which will be added to an Object[], and
replaced on the underlying message template.
protected String formatMessage(String strTemplateKey, Object[] aObj, boolean warnIfMissing)
strTemplateKey
- is a "pattern" used by MessageFormat objectaObj
- is an Object[] of parameters for replacement in the Pattern
public void audit(String strKey)
audit
in interface ILogger
strKey
- - ResourceBundle key that identifies the correct value for substitution into the
Locale specific message.public void audit(String message, boolean isDirect)
audit
in interface ILogger
message
- is just that, don't use it as a key for lookupisDirect
- should be set to true (yeah, this is stupid)
but necessary!public void audit(String strKey, Object[] aInfo)
audit
in interface ILogger
strKey
- is a String key for looking up the template in the
resource bundle.aInfo
- is an Object[] of params to use with the specified templatepublic void audit(String strKey, Object obj)
audit
in interface ILogger
strKey
- is a String key for looking up the template in the
resource bundle.obj
- is an object (typically a String) to use with the specified templatepublic void audit(Throwable exception)
audit
in interface ILogger
exception
- is the exception to log. We include a stack trace in the
log message.public void error(String strKey)
error
in interface ILogger
strKey
- used as a key for lookup of the actual message.public void error(String message, boolean isDirect)
error
in interface ILogger
message
- is just that, don't use it as a key for lookupisDirect
- should be set to true (yeah, this is stupid)public void error(String strKey, Object[] aInfo)
error
in interface ILogger
strKey
- is a String key for looking up the template in the
resource bundle.aInfo
- is an Object[] of params to use with the specified templatepublic void error(String strKey, Object obj)
error
in interface ILogger
strKey
- is a String key for looking up the template in the
resource bundle.obj
- is an object (typically a String) to use with the specified templatepublic void error(Throwable exception)
error
in interface ILogger
exception
- is the exception to log. We include a stack trace in the
log message.public void warn(String strKey)
warn
in interface ILogger
strKey
- used as a key for lookup of the actual message.public void warn(String message, boolean isDirect)
warn
in interface ILogger
message
- is just that, don't use it as a key for lookupisDirect
- should be set to true (yeah, this is stupid)public void warn(String strKey, Object[] aInfo)
warn
in interface ILogger
strKey
- is a String key for looking up the template in the
resource bundle.aInfo
- is an Object[] of params to use with the specified templatepublic void warn(String strKey, Object obj)
warn
in interface ILogger
strKey
- is a String key for looking up the template in the
resource bundle.obj
- is an object (typically a String) to use with the specified templatepublic void warn(Throwable exception)
warn
in interface ILogger
exception
- is the exception to log. We include a stack trace in the
log message.public void info(String strKey)
info
in interface ILogger
strKey
- is a key for message lookuppublic void info(String message, boolean isDirect)
info
in interface ILogger
message
- is just that, don't use it as a key for lookupisDirect
- should be set to true (yeah, this is stupid)public void info(String strKey, Object[] aInfo)
info
in interface ILogger
strKey
- is a String key for looking up the template in the
resource bundle.aInfo
- is an Object[] of params to use with the specified templatepublic void info(String strKey, Object obj)
info
in interface ILogger
strKey
- is a String key for looking up the template in the
resource bundle.obj
- is an object (typically a String) to use with the specified templatepublic void debug(String strMessage)
debug
in interface ILogger
strMessage
- is a messagepublic INestedDiagnosticContext getNDCInterface()
getNDCInterface
in interface ILogger
public void clearNDC()
clearNDC
in interface INestedDiagnosticContext
public Stack cloneNDCStack()
cloneNDCStack
in interface INestedDiagnosticContext
public String getNDC()
getNDC
in interface INestedDiagnosticContext
public int getNDCDepth()
getNDCDepth
in interface INestedDiagnosticContext
public void inheritNDC(Stack stack)
inheritNDC
in interface INestedDiagnosticContext
public void popNDC()
popNDC
in interface INestedDiagnosticContext
public void pushNDC(String message)
pushNDC
in interface INestedDiagnosticContext
public void removeNDC()
removeNDC
in interface INestedDiagnosticContext
public void setNDCMaxDepth(int depth)
setNDCMaxDepth
in interface INestedDiagnosticContext
public String toString()
protected String getLoggerInfo(org.apache.log4j.Logger c)
public static void dumpCategories()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |