org.webmacro.util
Class LogSource

java.lang.Object
  extended byorg.webmacro.util.LogSource
All Implemented Interfaces:
Log

public class LogSource
extends java.lang.Object
implements Log

A log is a simple recipient of information about the system. It does not display or render this information, but instead passes it back to a set of log targets. A log is administered by a LogManager so you cannot instantiate one directly. Instead you must ask the Logmanager or a log instance.


Method Summary
 void debug(java.lang.String msg)
          A shortform for debug(msg,null)
 void debug(java.lang.String msg, java.lang.Throwable e)
          Debug messages are incidental programmer notes which should not be enabled in a production system.
 void error(java.lang.String msg)
          A shortform for error(msg,null)
 void error(java.lang.String msg, java.lang.Throwable e)
          An error is a major failure within the system.
 java.lang.String getCategory()
          The category for this log source, as it woudl print in the log.
 java.lang.String getDescription()
          Get a description of this log source: what kind of messages does it contain? This can be a sentence or so of information about what kind of messages this log represents.
 java.lang.String getType()
          The type of this log source, as it would print in the log.
 boolean hasTargets()
           
 void info(java.lang.String msg)
          Info is fairly unimportant information about routine processing within the system.
protected  void log(int level, java.lang.String msg, java.lang.Throwable e)
           
 boolean loggingDebug()
          Ask the log system if it wants these kinds of log messages.
 boolean loggingInfo()
           
 boolean loggingNotice()
           
 boolean loggingWarning()
           
 void notice(java.lang.String msg)
          Notices are important information about routine processing within the system.
 java.lang.String toString()
          Explain myself
 void warning(java.lang.String msg)
          A shortform for warning(msg,null)
 void warning(java.lang.String msg, java.lang.Throwable e)
          Warnings are messages outlining unexpected non-routine events within the system.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

hasTargets

public final boolean hasTargets()

getType

public java.lang.String getType()
The type of this log source, as it would print in the log. For example "sys", or "log", or "wm". This type should be fairly short as it may be printed on every log line.


getDescription

public java.lang.String getDescription()
Get a description of this log source: what kind of messages does it contain? This can be a sentence or so of information about what kind of messages this log represents.


getCategory

public java.lang.String getCategory()
The category for this log source, as it woudl print in the log. This is the name which was passed to LogSystem to get the LogSystem instance from which this Log was created.


toString

public java.lang.String toString()
Explain myself


debug

public void debug(java.lang.String msg,
                  java.lang.Throwable e)
Debug messages are incidental programmer notes which should not be enabled in a production system. They are useful only during development.

Specified by:
debug in interface Log

debug

public void debug(java.lang.String msg)
A shortform for debug(msg,null)

Specified by:
debug in interface Log

info

public void info(java.lang.String msg)
Info is fairly unimportant information about routine processing within the system. They may be interesting on a production system, but also can typically be ignored.

Specified by:
info in interface Log

notice

public void notice(java.lang.String msg)
Notices are important information about routine processing within the system. For example, startup and shutdown messages. They are likely interesting to people running a production system since they provide timestamps for important events.

Specified by:
notice in interface Log

warning

public void warning(java.lang.String msg,
                    java.lang.Throwable e)
Warnings are messages outlining unexpected non-routine events within the system. They may indicate larger problems, but in and of themselves refer to problems the system is capable of handling on its own. On a correctly functioning production system you would expect to see only a few warnings.

Specified by:
warning in interface Log

warning

public void warning(java.lang.String msg)
A shortform for warning(msg,null)

Specified by:
warning in interface Log

error

public void error(java.lang.String msg)
A shortform for error(msg,null)

Specified by:
error in interface Log

error

public void error(java.lang.String msg,
                  java.lang.Throwable e)
An error is a major failure within the system. Typically it is something which cannot easily be handled by the system. On a correctly functioning production system you would not expect to see any error messages.

Specified by:
error in interface Log

loggingDebug

public boolean loggingDebug()
Description copied from interface: Log
Ask the log system if it wants these kinds of log messages. This is because the overhead of creating log messages is high, even if we're not going to log them, because it usually involves several string concatenations.

Specified by:
loggingDebug in interface Log

loggingInfo

public boolean loggingInfo()
Specified by:
loggingInfo in interface Log

loggingNotice

public boolean loggingNotice()
Specified by:
loggingNotice in interface Log

loggingWarning

public boolean loggingWarning()
Specified by:
loggingWarning in interface Log

log

protected void log(int level,
                   java.lang.String msg,
                   java.lang.Throwable e)