Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

cosmoworx.log
Class Log  view Log download Log.java

java.lang.Object
  extended bycosmoworx.log.Log
All Implemented Interfaces:
LogSettings, java.lang.Runnable

public final class Log
extends java.lang.Object
implements java.lang.Runnable, LogSettings

Responsible for handling application requests for logging. A Logger instance is registered witht the Log, then when a write request is made, it is forwarded to each Logger that was registered.


Field Summary
private static int miDefaultLevel
          The log level that the Log will use if the log level is not specified.
private static cosmoworx.util.thread.BlockingQueue moEntries
          The queue of log entries.
private static java.lang.Thread moWorker
          The worker thread.
private static java.util.Vector mvLoggers
          The list of registered Loggers.
 
Fields inherited from interface cosmoworx.log.LogSettings
ALL, CONFIG, DEBUG, ERROR, FATAL, INFO, NONE, WARN
 
Constructor Summary
private Log()
          The Log constructor is private so that no instances can be made.
 
Method Summary
static void addLogger(Logger aoLogger)
          Adds a Logger to the list of registered Loggers.
static int parseLevel(java.lang.String asLevel)
          Takes the string representation of a log level and returns the appropriate value.
static void removeLogger(Logger aoLogger)
          Removes a Logger from the list of registered Loggers.
 void run()
          Removes entries from the message queue and dispatches them to the loggers.
static java.lang.String valueOf(int anLevel)
          Returns the string representation of a log level.
static void write(int aiLevel, java.lang.String asMessage)
          Write a log entry using no source, the default log mode, and the specified log level.
static void write(int aiLevel, java.lang.Throwable aoThrowable)
          Write a log entry using no source, the default log mode, and the specified log level.
static void write(java.lang.Object aoSource, int aiLevel, java.lang.String asMessage)
          Write a log entry using the specified source, the default log mode, and the specified log level.
static void write(java.lang.Object aoSource, int aiLevel, java.lang.Throwable aoThrowable)
          Write a log entry using the specified source, the default log mode, and the specified log level.
static void write(java.lang.Object aoSource, java.lang.String asMessage)
          Write a log entry using the specified source, the default log mode, and the default log level.
static void write(java.lang.Object aoSource, java.lang.String asMode, int aiLevel, java.lang.String asMessage)
          Write a log entry using the specified source, the specified log mode, and the specified log level.
static void write(java.lang.Object aoSource, java.lang.String asMode, int aiLevel, java.lang.Throwable aoThrowable)
          Write a log entry using the specified source, the specified log mode, and the specified log level.
static void write(java.lang.Object aoSource, java.lang.String asMode, java.lang.String asMessage)
          Write a log entry using the specified source, the specified log mode, and the defaule log level.
static void write(java.lang.Object aoSource, java.lang.String asMode, java.lang.Throwable aoThrowable)
          Write a log entry using the specified source, the specified log mode, and the defaule log level.
static void write(java.lang.Object aoSource, java.lang.Throwable aoThrowable)
          Write a log entry using the specified source, the default log mode, and the default log level.
static void write(java.lang.String asMessage)
          Write a log entry using no source, the default log mode, and the default log level.
static void write(java.lang.String asMode, int aiLevel, java.lang.String asMessage)
          Write a log entry using no source, the specified log mode, and the specified log level.
static void write(java.lang.String asMode, int aiLevel, java.lang.Throwable aoThrowable)
          Write a log entry using no source, the specified log mode, and the specified log level.
static void write(java.lang.String asMode, java.lang.String asMessage)
          Write a log entry using no source, the specified log mode, and the default log level.
static void write(java.lang.String asMode, java.lang.Throwable aoThrowable)
          Write a log entry using no source, the specified log mode, and the default log level.
static void write(java.lang.Throwable aoThrowable)
          Write a log entry using no source, the default log mode, and the default log level.
static void writeBlank()
          Write a blank line.
static void writeHeader(java.lang.Object aoSource, java.lang.String asMode, int aiLevel)
          Write a header line.
static void writeTimestamp()
          Write a timestamp line.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mvLoggers

private static final java.util.Vector mvLoggers
The list of registered Loggers.


miDefaultLevel

private static int miDefaultLevel
The log level that the Log will use if the log level is not specified. Default is LogSettings.INFO.


moEntries

private static final cosmoworx.util.thread.BlockingQueue moEntries
The queue of log entries.


moWorker

private static java.lang.Thread moWorker
The worker thread.

Constructor Detail

Log

private Log()
The Log constructor is private so that no instances can be made.

Method Detail

run

public void run()
Removes entries from the message queue and dispatches them to the loggers.

Specified by:
run in interface java.lang.Runnable

addLogger

public static final void addLogger(Logger aoLogger)
Adds a Logger to the list of registered Loggers.


removeLogger

public static final void removeLogger(Logger aoLogger)
Removes a Logger from the list of registered Loggers.


write

public static final void write(java.lang.String asMessage)
Write a log entry using no source, the default log mode, and the default log level.


write

public static final void write(int aiLevel,
                               java.lang.String asMessage)
Write a log entry using no source, the default log mode, and the specified log level.


write

public static final void write(java.lang.String asMode,
                               java.lang.String asMessage)
Write a log entry using no source, the specified log mode, and the default log level.


write

public static final void write(java.lang.Object aoSource,
                               java.lang.String asMessage)
Write a log entry using the specified source, the default log mode, and the default log level.


write

public static final void write(java.lang.String asMode,
                               int aiLevel,
                               java.lang.String asMessage)
Write a log entry using no source, the specified log mode, and the specified log level.


write

public static final void write(java.lang.Object aoSource,
                               int aiLevel,
                               java.lang.String asMessage)
Write a log entry using the specified source, the default log mode, and the specified log level.


write

public static final void write(java.lang.Object aoSource,
                               java.lang.String asMode,
                               java.lang.String asMessage)
Write a log entry using the specified source, the specified log mode, and the defaule log level.


write

public static final void write(java.lang.Object aoSource,
                               java.lang.String asMode,
                               int aiLevel,
                               java.lang.String asMessage)
Write a log entry using the specified source, the specified log mode, and the specified log level.


write

public static final void write(java.lang.Throwable aoThrowable)
Write a log entry using no source, the default log mode, and the default log level.


write

public static final void write(int aiLevel,
                               java.lang.Throwable aoThrowable)
Write a log entry using no source, the default log mode, and the specified log level.


write

public static final void write(java.lang.String asMode,
                               java.lang.Throwable aoThrowable)
Write a log entry using no source, the specified log mode, and the default log level.


write

public static final void write(java.lang.Object aoSource,
                               java.lang.Throwable aoThrowable)
Write a log entry using the specified source, the default log mode, and the default log level.


write

public static final void write(java.lang.String asMode,
                               int aiLevel,
                               java.lang.Throwable aoThrowable)
Write a log entry using no source, the specified log mode, and the specified log level.


write

public static final void write(java.lang.Object aoSource,
                               int aiLevel,
                               java.lang.Throwable aoThrowable)
Write a log entry using the specified source, the default log mode, and the specified log level.


write

public static final void write(java.lang.Object aoSource,
                               java.lang.String asMode,
                               java.lang.Throwable aoThrowable)
Write a log entry using the specified source, the specified log mode, and the defaule log level.


write

public static final void write(java.lang.Object aoSource,
                               java.lang.String asMode,
                               int aiLevel,
                               java.lang.Throwable aoThrowable)
Write a log entry using the specified source, the specified log mode, and the specified log level.


writeBlank

public static final void writeBlank()
Write a blank line.


writeHeader

public static final void writeHeader(java.lang.Object aoSource,
                                     java.lang.String asMode,
                                     int aiLevel)
Write a header line.


writeTimestamp

public static final void writeTimestamp()
Write a timestamp line.


parseLevel

public static final int parseLevel(java.lang.String asLevel)
Takes the string representation of a log level and returns the appropriate value.


valueOf

public static final java.lang.String valueOf(int anLevel)
Returns the string representation of a log level.