Rakesh API

biz.wedoit4u
Class Logger

java.lang.Object
  extended by biz.wedoit4u.Logger

public class Logger
extends java.lang.Object

Utility class that is used to log errors/warnings/information to output files or to a back end database.

Copyright 2003, Rakesh Vidyadharan and wedoit4u.biz

Version:
$Id: Logger.java,v 1.4 2004/05/26 11:42:30 rakesh Exp $
Author:
Rakesh Vidyadharan 10th September 2003

Field Summary
static java.lang.String ERROR_LOG_PROPERTY
          The property that is used to denote the error log.
private static java.io.PrintStream errorStream
          The PrintStream to which error messages are to be written.
static java.lang.String OUT_LOG_PROPERTY
          The property that is used to denote the out log.
private static java.io.PrintStream outStream
          The PrintStream to which the messages are to be written.
 
Constructor Summary
Logger()
           
 
Method Summary
static void error(java.lang.String message)
          Log the specified error message to the errorStream.
static void error(java.lang.String message, java.lang.Throwable throwable)
          Log the specified error message to the errorStream.
static java.lang.String getHTMLStackTrace(java.lang.Throwable throwable)
          Utility method that prints out the entire stack trace for the specified instance of Throwable in HTML .
static java.lang.String getStackTrace(java.lang.Throwable throwable)
          Utility method that prints out the entire stack trace for the specified instance of Throwable.
static void message(java.lang.String message)
          Log the specified message to the outStream.
private static java.lang.String printHTMLTrace(java.lang.Throwable throwable)
          Return the stack trace for the specified instance of Throwable.
private static java.lang.String printTrace(java.lang.Throwable throwable)
          Return the stack trace for the specified instance of Throwable.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERROR_LOG_PROPERTY

public static final java.lang.String ERROR_LOG_PROPERTY
The property that is used to denote the error log.

See Also:
Constant Field Values

OUT_LOG_PROPERTY

public static final java.lang.String OUT_LOG_PROPERTY
The property that is used to denote the out log.

See Also:
Constant Field Values

errorStream

private static java.io.PrintStream errorStream
The PrintStream to which error messages are to be written.


outStream

private static java.io.PrintStream outStream
The PrintStream to which the messages are to be written.

Constructor Detail

Logger

public Logger()
Method Detail

error

public static final void error(java.lang.String message)
Log the specified error message to the errorStream.

Parameters:
message - - The error message to log.

error

public static final void error(java.lang.String message,
                               java.lang.Throwable throwable)
Log the specified error message to the errorStream. Print the StackTraceElement associated with the specified instance of Throwable as well.

Parameters:
message - - The error message to log
throwable - - The instance of Throwable whose StackTrace is to be logged.

message

public static final void message(java.lang.String message)
Log the specified message to the outStream.


getStackTrace

public static final java.lang.String getStackTrace(java.lang.Throwable throwable)
Utility method that prints out the entire stack trace for the specified instance of Throwable. This method just uses the StackTraceElement class methods to create the String that represents the entire stack trace.

Parameters:
throwable - - The instance of Throwable whose entire stack trace is to be retrieved.

printTrace

private static final java.lang.String printTrace(java.lang.Throwable throwable)
Return the stack trace for the specified instance of Throwable.

Parameters:
throwable - - The instance of Throwable whose stack trace is to be retrieved.

getHTMLStackTrace

public static final java.lang.String getHTMLStackTrace(java.lang.Throwable throwable)
Utility method that prints out the entire stack trace for the specified instance of Throwable in HTML . This method just uses the StackTraceElement class methods to create the HTML String that represents the entire stack trace.

Parameters:
throwable - - The instance of Throwable whose entire stack trace is to be retrieved.

printHTMLTrace

private static final java.lang.String printHTMLTrace(java.lang.Throwable throwable)
Return the stack trace for the specified instance of Throwable.

Parameters:
throwable - - The instance of Throwable whose stack trace is to be retrieved.

Rakesh API

Copyright © 2002-2005 - Rakesh Vidyadharan