|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.resilientedge.util.logger.Logger
This class defines the basic behavior for a Logger. A Logger object is used to generate log messages. Loggers create LogRecords and hand them to Handlers for proccessing and exporting. A Logger can have one or more Handlers, and will pass the LogRecord to all of its known handlers (assuming the Logger's filter allows it). A Logger can use a Filter to filter out messages that should not be logged. If no filter is used, then log messages of any level can be logged. If logging by key, the Logger can perform a lookup of the key from a message store (such as a resource bundle). In this way, the messages text can be maintained externally, but refrenced internally by key. By Default, loggers process log messages asynchronously. Use setAsync( false ) to configure the logger to process log records synchronously.
About Usage
In general, the logger can be used with the following syntax: Logger.getInstance().log( "foo" );
About Logger Properties
If a logger obtains its configuration from the properties system, two keys are required.
Field Summary | |
static java.lang.String |
LOG_FILTER
Description of the Field |
static java.lang.String |
LOG_HANDLERS
Description of the Field |
static int |
MAX_POOL_SIZE
Description of the Field |
static int |
MIN_POOL_SIZE
Description of the Field |
Constructor Summary | |
Logger()
|
Method Summary | |
void |
addHandler(Handler handler)
Add a handler to the Logger's list of Handlers. |
Filter |
getFilter()
Return the Logger's filter. |
java.util.Iterator |
getHandlers()
Returns an Iterator for the handlerList. |
static Logger |
getInstance()
This method will attempt to locate a more highly configured logger from the Log Factory. |
protected WorkerPool |
getWorkerPool()
This method returns the Logger's workerPool. |
protected void |
init()
This method performs any Logger initialization. |
boolean |
isAsync()
The method returns true if the logger can process log records asynchronously. |
boolean |
isEnabled()
State of the Logger |
abstract void |
log(java.lang.String rawMessage)
This method is for free form trace-logging where the level is assumed to be Trace and the message text does not represent a lookup key. |
abstract void |
log(java.lang.String rawMessage,
int level)
This method is for free form logging where a level and the logging message are supplied. |
abstract void |
log(java.lang.String key,
java.lang.Object[] insertValues)
Deprecated. |
abstract void |
log(java.lang.String key,
java.lang.Object[] insertValues,
int level)
Deprecated. |
abstract void |
log(java.lang.String key,
java.lang.Object[] insertValues,
java.lang.Throwable exception)
Deprecated. |
abstract void |
log(java.lang.String key,
java.lang.Object[] insertValues,
java.lang.Throwable exception,
int level)
Deprecated. |
abstract void |
log(java.lang.String topic,
java.lang.String rawMessage,
int level)
This method is for free form logging where a level and topic are provided in addition to the logging message. |
abstract void |
log(java.lang.String topic,
java.lang.String key,
java.lang.Object[] insertValues,
int level)
This method is used to log by lookup key. |
abstract void |
log(java.lang.String topic,
java.lang.String key,
java.lang.Object[] insertValues,
java.lang.Throwable exception,
int level)
Deprecated. |
abstract void |
log(java.lang.String topic,
java.lang.String rawMessage,
java.lang.Throwable exception,
int level)
Log a message by lookup key. |
abstract void |
log(java.lang.String rawMessage,
java.lang.Throwable exception)
Log a message and exception. |
abstract void |
log(java.lang.String rawMessage,
java.lang.Throwable exception,
int level)
Log a message, exception and level. |
abstract void |
log(java.lang.Throwable exception,
int level)
Log an exception with a level but without a message. |
boolean |
removeHandler(Handler handler)
Remove a handler from the Logger's list of handlers. |
void |
setAsync(boolean async)
Sets the Logger's ability to process logRecords asynchronously. |
static void |
setDefault(Logger logger)
Set the instance that will be returned by getInstance(). |
void |
setEnabled(boolean state)
Sets the Logger's logging state. |
void |
setFilter(Filter filter)
Give the Logger a Filter |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String LOG_HANDLERS
public static final java.lang.String LOG_FILTER
public static final int MIN_POOL_SIZE
public static final int MAX_POOL_SIZE
Constructor Detail |
public Logger()
Method Detail |
public void setEnabled(boolean state)
state
- true if the logger can currently log something.public void setAsync(boolean async)
async
- The new Async valuepublic void setFilter(Filter filter)
filter
- the Logger's Filter.public java.util.Iterator getHandlers()
public boolean isEnabled()
public boolean isAsync()
public Filter getFilter()
public void addHandler(Handler handler)
handler
- the handler to add.public boolean removeHandler(Handler handler)
handler
- public abstract void log(java.lang.String rawMessage)
rawMessage
- the log message text or a log message key.public abstract void log(java.lang.String rawMessage, int level)
rawMessage
- the log message text or a log message key.level
- the Level of importance or urgencypublic abstract void log(java.lang.String topic, java.lang.String rawMessage, int level)
topic
- the topic to which the message pertainsrawMessage
- the log message text or a log message key.level
- the level of importance or urgency.public abstract void log(java.lang.String topic, java.lang.String key, java.lang.Object[] insertValues, int level)
topic
- the topic to which the message pertainskey
- the log message's key (as stored in resource bundle)insertValues
- the array of objects used for substitution values.level
- the level of importance or urgency.public abstract void log(java.lang.String key, java.lang.Object[] insertValues)
key
- the log message's key (as stored in resource bundle)insertValues
- the array of objects used for substitution values.public abstract void log(java.lang.String key, java.lang.Object[] insertValues, int level)
key
- the log message's key (as stored in resource bundle)insertValues
- the array of objects used for substitution values.level
- the level of importance or urgency.public abstract void log(java.lang.Throwable exception, int level)
exception
- the exception whose stack-trace should be logged.level
- the level of importance or urgency.public abstract void log(java.lang.String rawMessage, java.lang.Throwable exception)
rawMessage
- the log message text or a log message key.exception
- the exception whose stack-trace should be logged.public abstract void log(java.lang.String rawMessage, java.lang.Throwable exception, int level)
rawMessage
- the log message text or a log message key.exception
- the exception whose stack-trace should be logged.level
- the level of importance or urgency.public abstract void log(java.lang.String topic, java.lang.String rawMessage, java.lang.Throwable exception, int level)
topic
- the topic to which the message pertainsexception
- the exception whose stack-trace should be logged.level
- the level of importance or urgency.rawMessage
- Description of Parameterpublic abstract void log(java.lang.String topic, java.lang.String key, java.lang.Object[] insertValues, java.lang.Throwable exception, int level)
topic
- the topic to which the message pertainskey
- the log message's key (as stored in resource bundle)insertValues
- the array of objects used for substitution values.exception
- the exception whose stack-trace should be logged.level
- the level of importance or urgency.public abstract void log(java.lang.String key, java.lang.Object[] insertValues, java.lang.Throwable exception)
key
- the log message's key (as stored in resource bundle)insertValues
- the array of objects used for substitution values.exception
- the exception whose stack-trace should be logged.public abstract void log(java.lang.String key, java.lang.Object[] insertValues, java.lang.Throwable exception, int level)
key
- the log message's key (as stored in resource bundle)insertValues
- the array of objects used for substitution values.exception
- the exception whose stack-trace should be logged.level
- the level of importance or urgency.public static void setDefault(Logger logger)
logger
- The new Default valuepublic static Logger getInstance()
protected WorkerPool getWorkerPool()
protected void init()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |