org.exolab.castor.util

Class Logger

public class Logger extends PrintWriter

Simple logging facility. This logger extends PrintWriter which is used to trace SQL statements, Castor operations and mapping resolutions.

This logger augments PrintWriter by adding a prefix to each printed line and optionally a time stamp, enabling easy post-mortem analysis.

Version: $Revision: 1.2 $ $Date: 2005/03/05 13:41:57 $

Author: Assaf Arkin

Constructor Summary
Logger(OutputStream output)
Constructs a new logger to use the specified output stream.
Logger(Writer writer)
Constructs a new logger to use the specified writer.
Method Summary
static PrintWritergetSystemLogger()
Returns the default logger.
protected voidprefixLine()
Called before printing from all of the print methods.
voidprint(boolean value)
voidprint(char value)
voidprint(int value)
voidprint(long value)
voidprint(float value)
voidprint(double value)
voidprint(char[] value)
voidprint(String value)
voidprint(Object value)
voidprintln()
voidprintln(boolean value)
voidprintln(char value)
voidprintln(int value)
voidprintln(long value)
voidprintln(float value)
voidprintln(double value)
voidprintln(char[] value)
voidprintln(String value)
voidprintln(Object value)
LoggersetLogTime(boolean logTime)
Determines whether to print the time at the beggining of each log line.
LoggersetPrefix(String prefix)
Sets the prefix, a short name to print at the beginning of each log line.
static voidsetSystemLogger(PrintWriter system)
Sets the default logger.

Constructor Detail

Logger

public Logger(OutputStream output)
Constructs a new logger to use the specified output stream.

Logger

public Logger(Writer writer)
Constructs a new logger to use the specified writer.

Method Detail

getSystemLogger

public static PrintWriter getSystemLogger()
Returns the default logger. This logger is used to produce system messages.

prefixLine

protected final void prefixLine()
Called before printing from all of the print methods. If at the beginning of a new line, the data/time and prefix will be printed.

print

public void print(boolean value)

print

public void print(char value)

print

public void print(int value)

print

public void print(long value)

print

public void print(float value)

print

public void print(double value)

print

public void print(char[] value)

print

public void print(String value)

print

public void print(Object value)

println

public void println()

println

public void println(boolean value)

println

public void println(char value)

println

public void println(int value)

println

public void println(long value)

println

public void println(float value)

println

public void println(double value)

println

public void println(char[] value)

println

public void println(String value)

println

public void println(Object value)

setLogTime

public Logger setLogTime(boolean logTime)
Determines whether to print the time at the beggining of each log line.

Parameters: logTime True if time should appear at the beggining of each log line

Returns: This logger

setPrefix

public Logger setPrefix(String prefix)
Sets the prefix, a short name to print at the beginning of each log line. If a null is passed, no prefix precedes logged lines.

Parameters: prefix The prefix to use for each line

Returns: This logger

setSystemLogger

public static void setSystemLogger(PrintWriter system)
Sets the default logger. This logger is used to produce system messages.
Intalio Inc. (C) 1999-2004. All rights reserved http://www.intalio.com