com.resilientedge.util.logger
Class SimpleLogger

java.lang.Object
  |
  +--com.resilientedge.util.logger.Logger
        |
        +--com.resilientedge.util.logger.SimpleLogger

public class SimpleLogger
extends Logger

Concrete implementation of a general purpose Logger.

The SimpleLogger, by default, is configured with a ConsoleHander (configured with a Console Formatter). The SimpleLogger does not have a Filter, and therefore log messages of any level should be logged by the SimpleLogger.

Author:
odh

Fields inherited from class com.resilientedge.util.logger.Logger
LOG_FILTER, LOG_HANDLERS, MAX_POOL_SIZE, MIN_POOL_SIZE
 
Constructor Summary
SimpleLogger()
          Loggers may be Singletons.
 
Method Summary
protected  LogRecord createLogRecord()
          This method returns a LogRecord matching the logger
 void localizeMessage(LogRecord logRecord)
          This method performs a message lookup, for situations where user is logging by key.
 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.
 void log(java.lang.String rawMessage, int level)
          This method is for free form logging where a level and the logging message are supplied.
 void log(java.lang.String key, java.lang.Object[] insertValues)
          This method is used to trace-log by key.
 void log(java.lang.String key, java.lang.Object[] insertValues, int level)
          This method is used to log by key and level.
 void log(java.lang.String key, java.lang.Object[] insertValues, java.lang.Throwable exception)
          Trace-log by key.
 void log(java.lang.String key, java.lang.Object[] insertValues, java.lang.Throwable exception, int level)
          Log by key and level.
 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.
 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.
 void log(java.lang.String topic, java.lang.String key, java.lang.Object[] insertValues, java.lang.Throwable exception, int level)
          Log a message by lookup key.
 void log(java.lang.String topic, java.lang.String rawMessage, java.lang.Throwable exception, int level)
          Log a message, level, topic and exception.
 void log(java.lang.String rawMessage, java.lang.Throwable exception)
          Log a message and exception.
 void log(java.lang.String rawMessage, java.lang.Throwable exception, int level)
          Log a message, exception and level.
 void log(java.lang.Throwable exception, int level)
          Log an exception with a level but without a message.
 java.lang.String lookupConfig(java.lang.String key)
          the implementation of this method returns the configuraton String value in the object's properties for the supplied key.
 
Methods inherited from class com.resilientedge.util.logger.Logger
addHandler, getFilter, getHandlers, getInstance, getWorkerPool, init, isAsync, isEnabled, removeHandler, setAsync, setDefault, setEnabled, setFilter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleLogger

public SimpleLogger()
Loggers may be Singletons. A reference to a logger can be obtained via Logger.getInstance().
Method Detail

log

public 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.
Overrides:
log in class Logger
Parameters:
rawMessage - the log message text or a log message key.

log

public void log(java.lang.String rawMessage,
                int level)
This method is for free form logging where a level and the logging message are supplied.
Overrides:
log in class Logger
Parameters:
rawMessage - the log message text or a log message key.
level - the Level of importance or urgency

log

public 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.
Overrides:
log in class Logger
Parameters:
topic - the topic to which the message pertains
rawMessage - the log message text or a log message key.
level - the level of importance or urgency.

log

public 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. If a level and/or Topic are supplied, they will override the level and/or topic of the message that corresponds to the supplied key. It is the job of a Handler to peform a lookup and String substitution (if the looked-up message contains String tokens) using the supplied insertValues. While it is up to a Handler's implementation, in most cases, if the key is not found then the the key is logged as the message. Logging will only be peformed if the Logger is enabled and if the level is not blocked by the Logger's Filtergate.
Overrides:
log in class Logger
Parameters:
topic - the topic to which the message pertains
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.

log

public void log(java.lang.String key,
                java.lang.Object[] insertValues)
This method is used to trace-log by key. If insertValue objects are supplied, then they will be used for string substitution in the looked up string. The topic will be looked-up in addition the message using the supplied key. The level is assumed to be Trace.
Overrides:
log in class Logger
Parameters:
key - the log message's key (as stored in resource bundle)
insertValues - the array of objects used for substitution values.

log

public void log(java.lang.String key,
                java.lang.Object[] insertValues,
                int level)
This method is used to log by key and level. If insertValue objects are supplied, then they will be used for string substitution in the looked up string. The topic will be looked-up in addition the message using the supplied key.
Overrides:
log in class Logger
Parameters:
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.

log

public void log(java.lang.Throwable exception,
                int level)
Log an exception with a level but without a message.
Overrides:
log in class Logger
Parameters:
exception - the exception whose stack-trace should be logged.
level - the level of importance or urgency.

log

public void log(java.lang.String rawMessage,
                java.lang.Throwable exception)
Log a message and exception.
Overrides:
log in class Logger
Parameters:
rawMessage - the log message text or a log message key.
exception - the exception whose stack-trace should be logged.

log

public void log(java.lang.String rawMessage,
                java.lang.Throwable exception,
                int level)
Log a message, exception and level.
Overrides:
log in class Logger
Parameters:
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.

log

public void log(java.lang.String topic,
                java.lang.String rawMessage,
                java.lang.Throwable exception,
                int level)
Log a message, level, topic and exception.
Overrides:
log in class Logger
Parameters:
topic - the topic to which the message pertains
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.

log

public void log(java.lang.String topic,
                java.lang.String key,
                java.lang.Object[] insertValues,
                java.lang.Throwable exception,
                int level)
Log a message by lookup key. In addition to key, level, topic, insert values and exception must be supplied.
Overrides:
log in class Logger
Parameters:
topic - the topic to which the message pertains
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.

log

public void log(java.lang.String key,
                java.lang.Object[] insertValues,
                java.lang.Throwable exception)
Trace-log by key. InsertValues and exception must be supplied.
Overrides:
log in class Logger
Parameters:
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.

log

public void log(java.lang.String key,
                java.lang.Object[] insertValues,
                java.lang.Throwable exception,
                int level)
Log by key and level. In addition, Insert Values and exception must be supplied.
Overrides:
log in class Logger
Parameters:
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.

localizeMessage

public void localizeMessage(LogRecord logRecord)
This method performs a message lookup, for situations where user is logging by key. The implementation provided in the Logger class does nothing. Subclasses that want to provide message lookup (Internationalization) should overide this method with their own implementation.
Parameters:
logRecord - the log record containg the log message to localize.

lookupConfig

public java.lang.String lookupConfig(java.lang.String key)
the implementation of this method returns the configuraton String value in the object's properties for the supplied key.
Parameters:
key - the log message's key (as stored in resource bundle)
Returns:
Description of the Returned Value

createLogRecord

protected LogRecord createLogRecord()
This method returns a LogRecord matching the logger
Returns:
a LogRecord that matches the specific logger


Copyright © 2001 Resilient Edge, Inc. All Rights Reserved.