com.ltu.smd116.misc
Class Log


public class Log

Insert the type's description here.
Creation date: (2/27/2001 4:06:57 PM)

Author:
:

Field Summary
 final static intDEBUG_EVENT
           
 private static intdefaultEventClass
          Default eventclass to use (if no eventclass is specified)
 private static PrintWriterdefaultWriter
           
 final static intERROR_EVENT
           
 private final static String[]eventClassNames
           
 final static intINFO_EVENT
           
 (package private) static booleaninitialized
           
 private static StringKEYNAME
           
 private static booleanstacktrace
           
 private static PrintWriter[]streamtable
           

Constructor Summary
Log()
          Constructor

Method Summary
 static voidEventLog(int eventClass, Exception exception)
           
 static voidEventLog(int eventClass, Object o, Exception exception)
           
 static voidEventLog(int eventClass, Object o, String message)
           
 static voidEventLog(int eventClass, String message)
           
 static voidEventLog(String message)
           
 private static StringformatMsg(String msg, int eventClass)
          Formats a message depending in eventClass and returns the String to
print to the logging stream.
 private static PrintWritergetWriter(int event_class)
          This method returns the PrintWriter to use for 'event_class'.
 private static synchronized voidinitialize()
           
 protected static PrintWriterparseAndCreateWriter(String fileName)
          This funtione creates a filewriter for a given filename.
 private static voidwriteLog(String msg, int eventClass)
          Demultiplexes the logging request to the correct output medium
by looking at its eventClass
 private static voidwriteStackTrace(int eventClass, java.lang.Throwable o)
          Demultiplexes the logging request to the correct output medium
by looking at its eventClass

Field Detail

DEBUG_EVENT

public final static int DEBUG_EVENT

defaultEventClass

private static int defaultEventClass
Default eventclass to use (if no eventclass is specified)

defaultWriter

private static PrintWriter defaultWriter

ERROR_EVENT

public final static int ERROR_EVENT

eventClassNames

private final static String[] eventClassNames

INFO_EVENT

public final static int INFO_EVENT

initialized

static boolean initialized

KEYNAME

private static String KEYNAME

stacktrace

private static boolean stacktrace

streamtable

private static PrintWriter[] streamtable
Constructor Detail

Log

public Log()
Constructor
Method Detail

EventLog

public static void EventLog(int eventClass, Exception exception)

EventLog

public static void EventLog(int eventClass, Object o, Exception exception)

EventLog

public static void EventLog(int eventClass, Object o, String message)

EventLog

public static void EventLog(int eventClass, String message)

EventLog

public static void EventLog(String message)

formatMsg

private static String formatMsg(String msg, int eventClass)
Formats a message depending in eventClass and returns the String to
print to the logging stream.
Parameters:
msg a - message included in the exception
eventClass a - classification of the error to be used in the event
log file
Returns: the String to print to the logging stream.

getWriter

private static PrintWriter getWriter(int event_class)
This method returns the PrintWriter to use for 'event_class'. The stream used
is determined on the configuration given in 'res'.
Parameters:
event_class a - classification of the error to be used in the event log file
Returns: the PrintWriter to use for 'event_class'.

initialize

private static synchronized void initialize()

parseAndCreateWriter

protected static PrintWriter parseAndCreateWriter(String fileName)
This funtione creates a filewriter for a given filename.
Parameters:
fileName the - file to be used
This value may be one of the following:
stdout - Standard out (console)
null - Null writer will be used (ie. none)
filename- A regular file will be used.
Returns: the PrintWriter for the value

writeLog

private static void writeLog(String msg, int eventClass)
Demultiplexes the logging request to the correct output medium
by looking at its eventClass
Parameters:
msg - a message included in the exception
eventClass - a classification of the error to be used in the event log file

writeStackTrace

private static void writeStackTrace(int eventClass, java.lang.Throwable o)
Demultiplexes the logging request to the correct output medium
by looking at its eventClass
Parameters:
msg - a message included in the exception
eventClass - a classification of the error to be used in the event log file

Association Links

to Class java.lang.String

to Class java.io.PrintWriter

to Class java.io.PrintWriter

to Class java.lang.String