org.apache.log
public class Logger extends Object
Modifier and Type | Field and Description |
---|---|
static char |
CATEGORY_SEPARATOR
Separator character use to separate different categories
|
private static Logger[] |
EMPTY_SET |
private boolean |
m_additivity
True means LogEvents will be sent to parents LogTargets
aswell as the ones set for this Logger.
|
private String |
m_category |
private Logger[] |
m_children |
private ErrorHandler |
m_errorHandler |
private LoggerListener |
m_loggerListener |
private LogTarget[] |
m_logTargets |
private boolean |
m_logTargetsForceSet |
private Logger |
m_parent |
private Priority |
m_priority |
private boolean |
m_priorityForceSet |
Constructor and Description |
---|
Logger(ErrorHandler errorHandler,
LoggerListener loggerListener,
String category,
LogTarget[] logTargets,
Logger parent)
Protected constructor for use inside the logging toolkit.
|
Modifier and Type | Method and Description |
---|---|
void |
debug(String message)
Log a debug priority event.
|
void |
debug(String message,
Throwable throwable)
Log a debug priority event.
|
void |
error(String message)
Log a error priority event.
|
void |
error(String message,
Throwable throwable)
Log a error priority event.
|
void |
fatalError(String message)
Log a fatalError priority event.
|
void |
fatalError(String message,
Throwable throwable)
Log a fatalError priority event.
|
private void |
fireEvent(LogEvent event,
LogTarget[] targets) |
Logger |
getChildLogger(String subCategory)
Create a new child logger.
|
Logger[] |
getChildren()
Get all the child Loggers of current logger.
|
void |
info(String message)
Log a info priority event.
|
void |
info(String message,
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,
String message)
Log a event at specific priority with a certain message.
|
void |
log(Priority priority,
String message,
Throwable throwable)
Log a event at specific priority with a certain message and throwable.
|
private void |
output(LogEvent event) |
private void |
output(Priority priority,
String message,
Throwable throwable)
Internal method to do actual outputting.
|
private void |
resetChildLogTargets(boolean recursive)
Update logTargets of children if any.
|
private void |
resetChildPriorities(boolean recursive)
Update priority of children if any.
|
private void |
resetLogTargets(boolean recursive)
Update logTarget of this Logger.
|
private void |
resetPriority(boolean recursive)
Update priority of this Logger.
|
private LogTarget[] |
safeGetLogTargets()
Retrieve logtarget array contained in logger.
|
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.
|
private void |
setupErrorHandlers()
Set ErrorHandlers of LogTargets if necessary.
|
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(String message)
Log a warn priority event.
|
void |
warn(String message,
Throwable throwable)
Log a warn priority event.
|
private static final Logger[] EMPTY_SET
public static final char CATEGORY_SEPARATOR
private final ErrorHandler m_errorHandler
private final LoggerListener m_loggerListener
private final Logger m_parent
private final String m_category
private Logger[] m_children
private LogTarget[] m_logTargets
private boolean m_logTargetsForceSet
private Priority m_priority
private boolean m_priorityForceSet
private boolean m_additivity
Logger(ErrorHandler errorHandler, LoggerListener loggerListener, String category, LogTarget[] logTargets, Logger parent)
errorHandler
- the ErrorHandler logger uses to log errorscategory
- the fully qualified name of categorylogTargets
- the LogTargets associated with loggerparent
- the parent logger (used for inheriting from)public final boolean isDebugEnabled()
public final void debug(String message, Throwable throwable)
message
- the messagethrowable
- the throwablepublic final void debug(String message)
message
- the messagepublic final boolean isInfoEnabled()
public final void info(String message, Throwable throwable)
message
- the messagethrowable
- the throwablepublic final void info(String message)
message
- the messagepublic final boolean isWarnEnabled()
public final void warn(String message, Throwable throwable)
message
- the messagethrowable
- the throwablepublic final void warn(String message)
message
- the messagepublic final boolean isErrorEnabled()
public final void error(String message, Throwable throwable)
message
- the messagethrowable
- the throwablepublic final void error(String message)
message
- the messagepublic final boolean isFatalErrorEnabled()
public final void fatalError(String message, Throwable throwable)
message
- the messagethrowable
- the throwablepublic final void fatalError(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, String message, Throwable throwable)
priority
- the prioritymessage
- the messagethrowable
- the throwablepublic final void log(Priority priority, 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(String subCategory) throws IllegalArgumentException
subCategory
- the subcategory of this loggerIllegalArgumentException
- if subCategory has an empty element nameprivate final void output(Priority priority, String message, Throwable throwable)
priority
- the prioritymessage
- the messagethrowable
- the throwableprivate final void output(LogEvent event)
private void resetChildPriorities(boolean recursive)
private void resetPriority(boolean recursive)
private LogTarget[] safeGetLogTargets()
private void resetChildLogTargets(boolean recursive)
private void setupErrorHandlers()
private void resetLogTargets(boolean recursive)
Copyright © 2003-2004 The Apache Software Foundation. All Rights Reserved.