org.apache.log
public class Logger extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static char |
CATEGORY_SEPARATOR
Separator character use to separate different categories
|
Modifier and Type | Method and Description |
---|---|
void |
debug(java.lang.String message)
Log a debug priority event.
|
void |
debug(java.lang.String message,
java.lang.Throwable throwable)
Log a debug priority event.
|
void |
error(java.lang.String message)
Log a error priority event.
|
void |
error(java.lang.String message,
java.lang.Throwable throwable)
Log a error priority event.
|
void |
fatalError(java.lang.String message)
Log a fatalError priority event.
|
void |
fatalError(java.lang.String message,
java.lang.Throwable throwable)
Log a fatalError priority event.
|
java.lang.String |
getCategory()
Deprecated.
This method violates Inversion of Control principle.
If you are relying on its presence then there may be
something wrong with the design of your system
|
Logger |
getChildLogger(java.lang.String subCategory)
Create a new child logger.
|
Logger[] |
getChildren()
Get all the child Loggers of current logger.
|
LogTarget[] |
getLogTargets()
Deprecated.
This method is deprecated and will be removed in Future version.
Previously it allowed unsafe access to logtargets which permitted
masqurade attacks. It currently returns a zero sized array.
|
Priority |
getPriority()
Deprecated.
This method violates Inversion of Control principle.
It will downgraded to protected access in a future
release. When user needs to check priority it is advised
that they use the is[Priority]Enabled() functions.
|
void |
info(java.lang.String message)
Log a info priority event.
|
void |
info(java.lang.String message,
java.lang.Throwable throwable)
Log a info priority event.
|
boolean |
isDebugEnabled()
Determine if messages of priority DEBUG will be logged.
|
boolean |
isErrorEnabled()
Determine if messages of priority ERROR will be logged.
|
boolean |
isFatalErrorEnabled()
Determine if messages of priority FATAL_ERROR will be logged.
|
boolean |
isInfoEnabled()
Determine if messages of priority INFO will be logged.
|
boolean |
isPriorityEnabled(Priority priority)
Determine if messages of priority ?will be logged.
|
boolean |
isWarnEnabled()
Determine if messages of priority WARN will be logged.
|
void |
log(Priority priority,
java.lang.String message)
Log a event at specific priority with a certain message.
|
void |
log(Priority priority,
java.lang.String message,
java.lang.Throwable throwable)
Log a event at specific priority with a certain message and throwable.
|
void |
setAdditivity(boolean additivity)
Make this logger additive.
|
void |
setLogTargets(LogTarget[] logTargets)
Set the log targets for this logger.
|
void |
setPriority(Priority priority)
Set the priority for this logger.
|
void |
unsetLogTargets()
Unset the logtargets for this logger.
|
void |
unsetLogTargets(boolean recursive)
Unset the logtargets for this logger and all child loggers if recursive is set.
|
void |
unsetPriority()
Unset the priority of Logger.
|
void |
unsetPriority(boolean recursive)
Unset the priority of Logger.
|
void |
warn(java.lang.String message)
Log a warn priority event.
|
void |
warn(java.lang.String message,
java.lang.Throwable throwable)
Log a warn priority event.
|
public static final char CATEGORY_SEPARATOR
public final boolean isDebugEnabled()
public final void debug(java.lang.String message, java.lang.Throwable throwable)
message
- the messagethrowable
- the throwablepublic final void debug(java.lang.String message)
message
- the messagepublic final boolean isInfoEnabled()
public final void info(java.lang.String message, java.lang.Throwable throwable)
message
- the messagethrowable
- the throwablepublic final void info(java.lang.String message)
message
- the messagepublic final boolean isWarnEnabled()
public final void warn(java.lang.String message, java.lang.Throwable throwable)
message
- the messagethrowable
- the throwablepublic final void warn(java.lang.String message)
message
- the messagepublic final boolean isErrorEnabled()
public final void error(java.lang.String message, java.lang.Throwable throwable)
message
- the messagethrowable
- the throwablepublic final void error(java.lang.String message)
message
- the messagepublic final boolean isFatalErrorEnabled()
public final void fatalError(java.lang.String message, java.lang.Throwable throwable)
message
- the messagethrowable
- the throwablepublic final void fatalError(java.lang.String message)
message
- the messagepublic final void setAdditivity(boolean additivity)
additivity
- true to make logger additive, false otherwisepublic final boolean isPriorityEnabled(Priority priority)
priority
- the prioritypublic final void log(Priority priority, java.lang.String message, java.lang.Throwable throwable)
priority
- the prioritymessage
- the messagethrowable
- the throwablepublic final void log(Priority priority, java.lang.String message)
priority
- the prioritymessage
- the messagepublic void setPriority(Priority priority)
priority
- the prioritypublic void unsetPriority()
public void unsetPriority(boolean recursive)
recursive
- true to unset priority of all child loggerspublic void setLogTargets(LogTarget[] logTargets)
logTargets
- the Log Targetspublic void unsetLogTargets()
public void unsetLogTargets(boolean recursive)
recursive
- the recursion policypublic Logger[] getChildren()
public Logger getChildLogger(java.lang.String subCategory) throws java.lang.IllegalArgumentException
subCategory
- the subcategory of this loggerjava.lang.IllegalArgumentException
- if subCategory has an empty element namepublic final Priority getPriority()
public final java.lang.String getCategory()
public LogTarget[] getLogTargets()