org.mortbay.log
Class LogImpl

java.lang.Object
  extended by org.mortbay.log.LogImpl
All Implemented Interfaces:
org.apache.commons.logging.Log

public class LogImpl
extends java.lang.Object
implements org.apache.commons.logging.Log

A Commons Log implementation for Jetty logs. The log can contain multiple log syncs. The following system properties can be used to control the configuration:

   DEBUG - if set debugging is output is enabled.
   DEBUG_PATTERNS - A list of substring patterns used to match against log information for
                    fine grained control of debug logging.
   DEBUG_VERBOSE - If set to a positive integer, trace and info are enabled.
                   If set to zero, then info is enabled.
   LOG_SINKS - List of class names used to instantiate the log sinks.
 
This logger can be configured with the org.mortbay.log.Factory

See Also:
LogFactory

Field Summary
 LogSink[] _sinks
           
static java.lang.String DEBUG
           
static java.lang.String ERROR
           
static java.lang.String FAIL
           
static java.lang.String INFO
           
static java.lang.String TRACE
           
static java.lang.String WARN
           
 
Constructor Summary
LogImpl()
          Construct the shared instance of Log that decodes the options setup in the environments properties.
 
Method Summary
 void add(LogSink logSink)
          Add a Log Sink.
 void add(java.lang.String logSinkClass)
          Add a Log Sink.
 void debug(java.lang.Object m)
           
 void debug(java.lang.Object m, java.lang.Throwable ex)
           
 void deleteStoppedLogSinks()
           
 void error(java.lang.Object arg0)
           
 void error(java.lang.Object arg0, java.lang.Throwable arg1)
           
 void fatal(java.lang.Object arg0)
           
 void fatal(java.lang.Object arg0, java.lang.Throwable arg1)
           
 boolean getDebug()
          Get the debug status.
 java.lang.String getDebugPatterns()
          Get the debug patterns.
 LogSink[] getLogSinks()
           
 boolean getSuppressWarnings()
          Get the warnings suppression status.
 int getVerbose()
          Get the verbosity level.
 void info(java.lang.Object arg0)
           
 void info(java.lang.Object arg0, java.lang.Throwable arg1)
           
 boolean isDebugEnabled()
           
 boolean isErrorEnabled()
           
 boolean isFatalEnabled()
           
 boolean isInfoEnabled()
           
 boolean isTraceEnabled()
           
 boolean isWarnEnabled()
           
 void message(java.lang.String tag, java.lang.Object msg)
          Log a message.
 void message(java.lang.String tag, java.lang.Object msg, Frame frame)
           
 void message(java.lang.String tag, java.lang.Object msg, Frame frame, long time)
          Log a message.
 void message(java.lang.String tag, java.lang.Object msg, int depth)
          Log a message.
 void reset()
          No logging.
 void setDebug(boolean debug)
          Set if debugging is on or off.
 void setDebugPatterns(java.lang.String patterns)
          Set debug patterns.
 void setSuppressWarnings(boolean warnings)
          Set warning suppression.
 void setVerbose(int verbose)
          Set verbosity level.
 void trace(java.lang.Object arg0)
           
 void trace(java.lang.Object arg0, java.lang.Throwable arg1)
           
 void warn(java.lang.Object arg0)
           
 void warn(java.lang.Object arg0, java.lang.Throwable arg1)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEBUG

public static final java.lang.String DEBUG
See Also:
Constant Field Values

INFO

public static final java.lang.String INFO
See Also:
Constant Field Values

TRACE

public static final java.lang.String TRACE
See Also:
Constant Field Values

FAIL

public static final java.lang.String FAIL
See Also:
Constant Field Values

WARN

public static final java.lang.String WARN
See Also:
Constant Field Values

ERROR

public static final java.lang.String ERROR
See Also:
Constant Field Values

_sinks

public LogSink[] _sinks
Constructor Detail

LogImpl

public LogImpl()
Construct the shared instance of Log that decodes the options setup in the environments properties.

Method Detail

add

public void add(LogSink logSink)
         throws java.lang.Exception
Add a Log Sink.

Parameters:
logSink -
Throws:
java.lang.Exception

add

public void add(java.lang.String logSinkClass)
Add a Log Sink.

Parameters:
logSinkClass - The logsink classname or null for the default.

debug

public void debug(java.lang.Object m)
Specified by:
debug in interface org.apache.commons.logging.Log

debug

public void debug(java.lang.Object m,
                  java.lang.Throwable ex)
Specified by:
debug in interface org.apache.commons.logging.Log

deleteStoppedLogSinks

public void deleteStoppedLogSinks()

reset

public void reset()
No logging. All log sinks are stopped and removed.


error

public void error(java.lang.Object arg0)
Specified by:
error in interface org.apache.commons.logging.Log

error

public void error(java.lang.Object arg0,
                  java.lang.Throwable arg1)
Specified by:
error in interface org.apache.commons.logging.Log

fatal

public void fatal(java.lang.Object arg0)
Specified by:
fatal in interface org.apache.commons.logging.Log

fatal

public void fatal(java.lang.Object arg0,
                  java.lang.Throwable arg1)
Specified by:
fatal in interface org.apache.commons.logging.Log

getDebug

public boolean getDebug()
Get the debug status.

Returns:
the debug status

getDebugPatterns

public java.lang.String getDebugPatterns()
Get the debug patterns.

Returns:
Coma separated list of debug patterns

getLogSinks

public LogSink[] getLogSinks()

getSuppressWarnings

public boolean getSuppressWarnings()
Get the warnings suppression status.

Returns:
the warnings suppression status

getVerbose

public int getVerbose()
Get the verbosity level.

Returns:
the verbosity level

info

public void info(java.lang.Object arg0)
Specified by:
info in interface org.apache.commons.logging.Log

info

public void info(java.lang.Object arg0,
                 java.lang.Throwable arg1)
Specified by:
info in interface org.apache.commons.logging.Log

isDebugEnabled

public boolean isDebugEnabled()
Specified by:
isDebugEnabled in interface org.apache.commons.logging.Log

isErrorEnabled

public boolean isErrorEnabled()
Specified by:
isErrorEnabled in interface org.apache.commons.logging.Log

isFatalEnabled

public boolean isFatalEnabled()
Specified by:
isFatalEnabled in interface org.apache.commons.logging.Log

isInfoEnabled

public boolean isInfoEnabled()
Specified by:
isInfoEnabled in interface org.apache.commons.logging.Log

isTraceEnabled

public boolean isTraceEnabled()
Specified by:
isTraceEnabled in interface org.apache.commons.logging.Log

isWarnEnabled

public boolean isWarnEnabled()
Specified by:
isWarnEnabled in interface org.apache.commons.logging.Log

message

public void message(java.lang.String tag,
                    java.lang.Object msg,
                    Frame frame)

message

public void message(java.lang.String tag,
                    java.lang.Object msg,
                    Frame frame,
                    long time)
Log a message.

Parameters:
tag - Tag for type of log
msg - The message
frame - The frame that generated the message.
time - The time stamp of the message.

message

public void message(java.lang.String tag,
                    java.lang.Object msg)
Log a message.

Parameters:
tag - Tag for type of log
msg - The message

message

public void message(java.lang.String tag,
                    java.lang.Object msg,
                    int depth)
Log a message.

Parameters:
tag - Tag for type of log
msg - The message

setDebug

public void setDebug(boolean debug)
Set if debugging is on or off.

Parameters:
debug -

setDebugPatterns

public void setDebugPatterns(java.lang.String patterns)
Set debug patterns.

Parameters:
patterns - comma separated string of patterns

setSuppressWarnings

public void setSuppressWarnings(boolean warnings)
Set warning suppression.

Parameters:
warnings - Warnings suppress if this is true and debug is false

setVerbose

public void setVerbose(int verbose)
Set verbosity level.

Parameters:
verbose -

trace

public void trace(java.lang.Object arg0)
Specified by:
trace in interface org.apache.commons.logging.Log

trace

public void trace(java.lang.Object arg0,
                  java.lang.Throwable arg1)
Specified by:
trace in interface org.apache.commons.logging.Log

warn

public void warn(java.lang.Object arg0)
Specified by:
warn in interface org.apache.commons.logging.Log

warn

public void warn(java.lang.Object arg0,
                 java.lang.Throwable arg1)
Specified by:
warn in interface org.apache.commons.logging.Log


Copyright © 2004 Mortbay Consulting Pty. Ltd. All Rights Reserved.