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

Quick Search    Search Deep

com.go.trove.log
Class LogScribe  view LogScribe download LogScribe.java

java.lang.Object
  extended bycom.go.trove.log.LogScribe
All Implemented Interfaces:
java.util.EventListener, LogListener

public class LogScribe
extends java.lang.Object
implements LogListener

LogScribe is a LogListener that writes log messages to a PrintWriter. Each message is printed to a line that is prepended with other LogEvent information. The default prepend format is as follows:

 [event type code],[date & time],[thread name],[log source name]>[one space]
 
The event type codes are " D", " I", "*W" and "*E" for debug, info, warn and error, respectively. The default date format looks like this: "1999/06/08 18:08:34.067 PDT". If there is no log source, or it has no name, it is omitted from the prepend. Here is a sample line that is written out:
  I,1999/06/08 18:08:34.67 PDT,main> Started Transaction Manager
 

Version:
20 , 01/07/02

Field Summary
private  com.go.trove.util.FastDateFormat mFastFormat
           
private  boolean mShowSourceName
           
private  boolean mShowThread
           
private  java.text.DateFormat mSlowFormat
           
private  java.io.PrintWriter mWriter
           
 
Constructor Summary
LogScribe(java.io.PrintWriter writer)
           
LogScribe(java.io.PrintWriter writer, java.text.DateFormat format)
           
LogScribe(java.io.PrintWriter writer, com.go.trove.util.FastDateFormat format)
           
 
Method Summary
protected  java.lang.String createPrepend(LogEvent e)
          Creates the default line prepend for a message.
 boolean isShowSourceEnabled()
          The showing of the event source name is on by default.
 boolean isShowThreadEnabled()
          The showing of the event thread name is on by default.
 void logException(LogEvent e)
          Called for LogEvents that should be logged as an exception.
 void logMessage(LogEvent e)
          Called for LogEvents that should be logged like an ordinary message.
 void setShowSourceEnabled(boolean enabled)
           
 void setShowThreadEnabled(boolean enabled)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mWriter

private java.io.PrintWriter mWriter

mSlowFormat

private java.text.DateFormat mSlowFormat

mFastFormat

private com.go.trove.util.FastDateFormat mFastFormat

mShowThread

private boolean mShowThread

mShowSourceName

private boolean mShowSourceName
Constructor Detail

LogScribe

public LogScribe(java.io.PrintWriter writer)

LogScribe

public LogScribe(java.io.PrintWriter writer,
                 java.text.DateFormat format)

LogScribe

public LogScribe(java.io.PrintWriter writer,
                 com.go.trove.util.FastDateFormat format)
Method Detail

logMessage

public void logMessage(LogEvent e)
Description copied from interface: LogListener
Called for LogEvents that should be logged like an ordinary message.

Specified by:
logMessage in interface LogListener

logException

public void logException(LogEvent e)
Description copied from interface: LogListener
Called for LogEvents that should be logged as an exception. The LogEvent object will likely have an Exception object in it.

Specified by:
logException in interface LogListener

isShowThreadEnabled

public boolean isShowThreadEnabled()
The showing of the event thread name is on by default.


setShowThreadEnabled

public void setShowThreadEnabled(boolean enabled)

isShowSourceEnabled

public boolean isShowSourceEnabled()
The showing of the event source name is on by default.


setShowSourceEnabled

public void setShowSourceEnabled(boolean enabled)

createPrepend

protected java.lang.String createPrepend(LogEvent e)
Creates the default line prepend for a message.