org.jlf.log
Class MultiThreadLog

java.lang.Object
  |
  +--org.jlf.log.Log
        |
        +--org.jlf.log.MultiThreadLog

public class MultiThreadLog
extends Log

MultiThreadLog is an extension of the Log class to add information to each log entry specifying the thread that generated the entry. In a multi-threaded application, a particular log file may be intermixed with a number of entries from a number of threads. To make sense of what is going on in a particular thread, this type of log will prepend all entries with the name of the thread, so you can "grep" out a particular thread of interest.

Like the Log class, this class could be extended to do application-specific behavior, or better yet you could create a class "wrapper" like AppLog to make instances well-known Singletons with handy static/class methods.

See Also:
Log, AppLog

Field Summary
 
Fields inherited from class org.jlf.log.Log
CRITICAL_ERROR_LEVEL, currentLoggingLevel, dateOpened, DEACTIVATE_LEVEL, DETAIL_LEVEL, ERROR_LEVEL, INFO_LEVEL, logFieldSeparator, LOGGING_MECHANISMS, loggingMechanisms, name, SHARED_DATED_FILE_MECHANISM, SHARED_FILE_MECHANISM, SMTP_MECHANISM, STANDARD_ERR_MECHANISM, TRACE_LEVEL, UNIQUE_DATED_FILE_MECHANISM, UNIQUE_FILE_MECHANISM, WARNING_LEVEL
 
Constructor Summary
MultiThreadLog(java.lang.String name)
          Public constructor to register a new MultiThreadLog with a particular name.
 
Method Summary
 void logString(java.lang.String logString, int loggingLevel)
          Adds a message string to the log if the log's level is currently set at or above the loggingLevel passed in.
 
Methods inherited from class org.jlf.log.Log
addLoggingMechanism, finalize, getDateOpened, getLogFieldSeparator, getLoggingLevel, getLoggingMechanism, getLoggingMechanisms, getName, isLoggingEnabledFor, isOpen, removeAllLoggingMechanisms, removeLoggingMechanism, setLogFieldSeparator, setLoggingLevel
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiThreadLog

public MultiThreadLog(java.lang.String name)
Public constructor to register a new MultiThreadLog with a particular name. The name of the log is very important. It is used as a key into the log properties file to find settings for how the log is to be opened.

Method Detail

logString

public void logString(java.lang.String logString,
                      int loggingLevel)
Adds a message string to the log if the log's level is currently set at or above the loggingLevel passed in. Prepends the current thread name before the log entry.

Overrides:
logString in class Log
Parameters:
logString - The string to write to all logging mechanisms
loggingLevel - The level at which to log the string.