com.cafesoft.core.log
Class StandardLog4JLogger

java.lang.Object
  |
  +--com.cafesoft.core.log.StandardLog4JLogger
All Implemented Interfaces:
Log4JLogger, Logger

public class StandardLog4JLogger
extends Object
implements Log4JLogger

StandardLog4JLogger uses Apache's Log4j API to write log messages to Appender Objects that are added to this Logger.
Configuration properties supported by this Logger include:

Since:
7/11/02

Field Summary
 
Fields inherited from interface com.cafesoft.core.log.Logger
DEBUG, ERROR, FATAL, INFO, WARNING
 
Constructor Summary
StandardLog4JLogger()
          Create a new StandardLog4JLogger This StandardLog4JLogger will log any debug to System.err
StandardLog4JLogger(PrintStream loggerDebugStream)
          Create a new StandardLog4JLogger with the designated logger PrintStream.
 
Method Summary
 void addAppender(org.apache.log4j.Appender appender)
          Add an appender to the Logger
 void debug(Object source, String message)
          Log a debug message from the specified source object.
 void debug(Object source, String message, Throwable throwable)
          Log a debug message from the specified source object.
 void error(Object source, String message)
          Log a error message from the specified source object.
 void error(Object source, String message, Throwable throwable)
          Log a error message from the specified source object.
 void fatal(Object source, String message)
          Log a fatal message from the specified source object.
 void fatal(Object source, String message, Throwable throwable)
          Log a fatal message from the specified source object.
 void info(Object source, String message)
          Log an info message from the specified source object.
 void info(Object source, String message, Throwable throwable)
          Log an info message from the specified source object.
 void initialize(Properties prop)
          Initialize the Logger.
 void removeAppender(org.apache.log4j.Appender appender)
          Remove an appender from the Logger
 void setFullyQualifiedClassName(String className)
          Set the fully qualified class name of the calling class.
 void setMessageFilter(MessageFilter filter)
          Set a message filter.
 void warning(Object source, String message)
          Log a warning message from the specified source object.
 void warning(Object source, String message, Throwable throwable)
          Log a warning message from the specified source object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardLog4JLogger

public StandardLog4JLogger()
Create a new StandardLog4JLogger

This StandardLog4JLogger will log any debug to System.err


StandardLog4JLogger

public StandardLog4JLogger(PrintStream loggerDebugStream)
Create a new StandardLog4JLogger with the designated logger PrintStream.

Parameters:
loggerDebugStream - the PrintStream Object that is used to output any debug messages generated by the StandardLog4JLogger Object
Method Detail

setFullyQualifiedClassName

public void setFullyQualifiedClassName(String className)
Set the fully qualified class name of the calling class.

Setting this value will allow for the logger to maintain the class that actually called the log method. This is a log4j specific detail. We need this set otherwise any class that "has a" Log4JLogger will not print out the appropriate class information.

Specified by:
setFullyQualifiedClassName in interface Log4JLogger
Parameters:
className - the fully-qualified class name

addAppender

public void addAppender(org.apache.log4j.Appender appender)
Add an appender to the Logger

Specified by:
addAppender in interface Log4JLogger
Parameters:
appender - the Appender Object to add to the Logger

removeAppender

public void removeAppender(org.apache.log4j.Appender appender)
Remove an appender from the Logger

Specified by:
removeAppender in interface Log4JLogger
Parameters:
appender - the Appender Object to remove from the Logger

initialize

public void initialize(Properties prop)
                throws LoggerException
Initialize the Logger.

Specified by:
initialize in interface Logger
Parameters:
prop - initialization Properties.
Throws:
LoggerException - if an error initializing the Logger.

setMessageFilter

public void setMessageFilter(MessageFilter filter)
Set a message filter.

Specified by:
setMessageFilter in interface Logger
Parameters:
filter - the MessageFilter that discriminates the messages to be logged.

debug

public void debug(Object source,
                  String message)
Log a debug message from the specified source object.

Specified by:
debug in interface Logger
Parameters:
source - the source of the message.
message - the debug message to be logged.

debug

public void debug(Object source,
                  String message,
                  Throwable throwable)
Log a debug message from the specified source object.

Specified by:
debug in interface Logger
Parameters:
source - the source of the message.
message - the debug message to be logged.
throwable - an Exception or Error to be logged.

info

public void info(Object source,
                 String message)
Log an info message from the specified source object.

Specified by:
info in interface Logger
Parameters:
source - the source of the message.
message - the info message to be logged.

info

public void info(Object source,
                 String message,
                 Throwable throwable)
Log an info message from the specified source object.

Specified by:
info in interface Logger
Parameters:
source - the source of the message.
message - the info message to be logged.
throwable - an Exception or Error to be logged.

warning

public void warning(Object source,
                    String message)
Log a warning message from the specified source object.

Specified by:
warning in interface Logger
Parameters:
source - the source of the message.
message - the info message to be logged.

warning

public void warning(Object source,
                    String message,
                    Throwable throwable)
Log a warning message from the specified source object.

Specified by:
warning in interface Logger
Parameters:
source - the source of the message.
message - the warning message to be logged.
throwable - an Exception or Error to be logged.

error

public void error(Object source,
                  String message)
Log a error message from the specified source object.

Specified by:
error in interface Logger
Parameters:
source - the source of the message.
message - the info message to be logged.

error

public void error(Object source,
                  String message,
                  Throwable throwable)
Log a error message from the specified source object.

Specified by:
error in interface Logger
Parameters:
source - the source of the message.
message - the error message to be logged.
throwable - an Exception or Error to be logged.

fatal

public void fatal(Object source,
                  String message)
Log a fatal message from the specified source object.

Specified by:
fatal in interface Logger
Parameters:
source - the source of the message.
message - the info message to be logged.

fatal

public void fatal(Object source,
                  String message,
                  Throwable throwable)
Log a fatal message from the specified source object.

Specified by:
fatal in interface Logger
Parameters:
source - the source of the message.
message - the fatal message to be logged.
throwable - an Exception or Error to be logged.


Generated on 8:41:50 AM June 06, 2005, © 1996-2005 Cafésoft LLC. All rights reserved.