com.rhi.architecture.logging
Class Log4JLogger

java.lang.Object
  extended bycom.rhi.architecture.logging.Logger
      extended bycom.rhi.architecture.logging.Log4JLogger
All Implemented Interfaces:
Resource

public final class Log4JLogger
extends Logger

Log4JLogger

Since:
1.2
Author:
Pete McKinstry

Field Summary
static java.lang.String FILE_APPENDER
          file appender to use
static java.lang.String LOG4J_PROPERTYFILE
          log4j config filename.
static java.lang.String LOGFILE_PATH
          path to write logfile to
static java.lang.String SPACER
          space for msg templates.
 
Fields inherited from class com.rhi.architecture.logging.Logger
DEFAULT_CATEGORY, KEY
 
Constructor Summary
Log4JLogger()
          Default constructor.
Log4JLogger(java.lang.String categoryName)
          constructor used for new model, where multiple Loggers are supported.
 
Method Summary
 void close()
          Perform whatever cleanup is required of the underlying object..
 void debug(java.lang.String message)
          Log the provided debug message.
 void debug(java.lang.String className, java.lang.String message)
          So that InterfaceLogger works correctly (details such as filename, line number, etc...
 void error(java.lang.String message)
          Log the provided error message.
 void error(java.lang.String className, java.lang.String message)
          So that InterfaceLogger works correctly (details such as filename, line number, etc...
 void error(java.lang.String className, java.lang.String message, java.lang.Throwable t)
          So that InterfaceLogger works correctly (details such as filename, line number, etc...
 void error(java.lang.String message, java.lang.Throwable t)
          Log the provided error message.
 void fatal(java.lang.String message)
          Log a message w/ a fatal priority.
 void fatal(java.lang.String className, java.lang.String message)
          So that InterfaceLogger works correctly (details such as filename, line number, etc...
 void fatal(java.lang.String className, java.lang.String message, java.lang.Throwable t)
          So that InterfaceLogger works correctly (details such as filename, line number, etc...
 void fatal(java.lang.String message, java.lang.Throwable t)
          Log a message w/ a fatal priority.
 LogFactory getFactory(java.util.Properties p)
          Load factory - used only for backward compatibility to support users who don't know about the new LogFactory interface & are initializing the Logger class directly.
 void info(java.lang.String message)
          log the provided informational message.
 void info(java.lang.String className, java.lang.String message)
          So that InterfaceLogger works correctly (details such as filename, line number, etc...
 void init(java.util.Properties p)
          Perform whatever initialization is required of the resource.
 boolean isDebugEnabled()
          Check whether this category is enabled for the DEBUG Level.
 boolean isInfoEnabled()
          Check whether this category is enabled for the INFO Level.
 boolean isTraceEnabled()
          Check whether this category is enabled for the TRACE Level.
 boolean isWarningEnabled()
          Check whether this category is enabled for the WARN Level.
 void trace(java.lang.String message)
          Log a message w/ a trace priority.
 void trace(java.lang.String className, java.lang.String message)
           
 void warning(java.lang.String message)
          Log the provided warning message.
 void warning(java.lang.String className, java.lang.String message)
          So that InterfaceLogger works correctly (details such as filename, line number, etc...
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FILE_APPENDER

public static final java.lang.String FILE_APPENDER
file appender to use

See Also:
Constant Field Values

LOG4J_PROPERTYFILE

public static final java.lang.String LOG4J_PROPERTYFILE
log4j config filename.

See Also:
Constant Field Values

LOGFILE_PATH

public static final java.lang.String LOGFILE_PATH
path to write logfile to

See Also:
Constant Field Values

SPACER

public static final java.lang.String SPACER
space for msg templates.

See Also:
Constant Field Values
Constructor Detail

Log4JLogger

public Log4JLogger()
Default constructor. - for backwkard compatibility.


Log4JLogger

public Log4JLogger(java.lang.String categoryName)
constructor used for new model, where multiple Loggers are supported.

Parameters:
categoryName -
Method Detail

init

public void init(java.util.Properties p)
          throws InitializationException
Perform whatever initialization is required of the resource. This method should only be called once per application instance.

Specified by:
init in interface Resource
Specified by:
init in class Logger
Parameters:
p -
Throws:
InitializationException
Since:
1.2

getFactory

public LogFactory getFactory(java.util.Properties p)
                      throws ConfigurationException,
                             InitializationException
Load factory - used only for backward compatibility to support users who don't know about the new LogFactory interface & are initializing the Logger class directly. Register the LogFactory so that it can be cleaned up by the architecture upon application shutdown.

Parameters:
p -
Returns:
LogFactory
Throws:
ConfigurationException
InitializationException
Since:
1.5

close

public void close()
Perform whatever cleanup is required of the underlying object..

Specified by:
close in interface Resource
Specified by:
close in class Logger
Since:
1.2

fatal

public void fatal(java.lang.String message)
Log a message w/ a fatal priority. Fatal messages are usually not recoverable & will precede an application shutdown. Actual support for this priority is log implementation specific, but should be available in most packages. (e.g. Log4J, JDK1.4)

Specified by:
fatal in class Logger
Parameters:
message - - log message
Since:
1.0

fatal

public void fatal(java.lang.String className,
                  java.lang.String message)
So that InterfaceLogger works correctly (details such as filename, line number, etc... so up correctly.)

Parameters:
className -
message -
Since:
1.01

fatal

public void fatal(java.lang.String message,
                  java.lang.Throwable t)
Log a message w/ a fatal priority. Fatal messages are usually not recoverable & will precede an application shutdown. Actual support for this priority is log implementation specific, but should be available in most packages. (e.g. Log4J, JDK1.4)

Specified by:
fatal in class Logger
Parameters:
message - - log message
t - - the exception causing the fatal error.
Since:
1.0

fatal

public void fatal(java.lang.String className,
                  java.lang.String message,
                  java.lang.Throwable t)
So that InterfaceLogger works correctly (details such as filename, line number, etc... so up correctly.)

Parameters:
className -
message - - log message
t - - the exception causing the fatal error.
Since:
1.01

error

public void error(java.lang.String message)
Log the provided error message. Note: The Priority of messages logged w/ the error() method is org.apache.log4j.Priority.ERROR.

Specified by:
error in class Logger
Parameters:
message - - error message
Since:
1.2

error

public void error(java.lang.String className,
                  java.lang.String message)
So that InterfaceLogger works correctly (details such as filename, line number, etc... so up correctly.)

Parameters:
className -
message -
Since:
1.01

error

public void error(java.lang.String message,
                  java.lang.Throwable t)
Log the provided error message. Note: The Priority of messages logged w/ the error() method is org.apache.log4j.Priority.ERROR.

Specified by:
error in class Logger
Parameters:
message - - error message
t - - the exception causing the error.
Since:
1.2

error

public void error(java.lang.String className,
                  java.lang.String message,
                  java.lang.Throwable t)
So that InterfaceLogger works correctly (details such as filename, line number, etc... so up correctly.)

Parameters:
className -
message - - log message
t - - the exception causing the fatal error.
Since:
1.01

warning

public final void warning(java.lang.String message)
Log the provided warning message. This method allows for developers to easily log free form messages about the program status. It is designed to be easy to use & simple to encourage debug messages in the code. Note: The Priority of messages logged w/ the info() method is org.apache.log4j.Priority.WARNING. These message can be disabled in the log4j configuration file when deploying to a production environment. (or for performance testing.) *

Specified by:
warning in class Logger
Parameters:
message - - log message
Since:
1.01

warning

public final void warning(java.lang.String className,
                          java.lang.String message)
So that InterfaceLogger works correctly (details such as filename, line number, etc... so up correctly.)

Parameters:
className -
message - - log message
Since:
1.01

isWarningEnabled

public boolean isWarningEnabled()
Check whether this category is enabled for the WARN Level.

Specified by:
isWarningEnabled in class Logger
Returns:
boolean
Since:
1.0

info

public final void info(java.lang.String message)
log the provided informational message. This method allows for developers to easily log free form messages about the program status. It is designed to be easy to use & simple to encourage debug messages in the code. Note: The Priority of messages logged w/ the info() method is org.apache.log4j.Priority.INFO. These message can be disabled in the log4j configuration file when deploying to a production environment. (or for performance testing.)

Specified by:
info in class Logger
Parameters:
message - - log message
Since:
1.01

info

public final void info(java.lang.String className,
                       java.lang.String message)
So that InterfaceLogger works correctly (details such as filename, line number, etc... so up correctly.)

Parameters:
className -
message - - log message
Since:
1.01

isInfoEnabled

public boolean isInfoEnabled()
Check whether this category is enabled for the INFO Level.

Specified by:
isInfoEnabled in class Logger
Returns:
boolean
Since:
1.0

debug

public final void debug(java.lang.String message)
Log the provided debug message. This method allows for developers to easily log free form messages about the program status. It is designed to be easy to use & simple to encourage debug messages in the code. Note: The Priority of messages logged w/ the info() method is org.apache.log4j.Priority.INFO. These message can be disabled in the log4j configuration file when deploying to a production environment. (or for performance testing.)

Specified by:
debug in class Logger
Parameters:
message - - log message
Since:
1.01

debug

public final void debug(java.lang.String className,
                        java.lang.String message)
So that InterfaceLogger works correctly (details such as filename, line number, etc... so up correctly.)

Parameters:
className -
message - - log message
Since:
1.01

isDebugEnabled

public boolean isDebugEnabled()
Check whether this category is enabled for the DEBUG Level.

Specified by:
isDebugEnabled in class Logger
Returns:
boolean
Since:
1.0

trace

public void trace(java.lang.String message)
Description copied from class: Logger
Log a message w/ a trace priority. Trace messages are the most granular and will normally be disabled in production environments, but can be quite useful during development. If the underlying logging implementation does not support this level, trace messages should be logged w/ the most verbose logging level available.

Specified by:
trace in class Logger
Parameters:
message - - log message
See Also:
Logger.trace(String)

trace

public void trace(java.lang.String className,
                  java.lang.String message)
Parameters:
className -
message - - log message
See Also:
Logger.trace(String)

isTraceEnabled

public boolean isTraceEnabled()
Description copied from class: Logger
Check whether this category is enabled for the TRACE Level.

Specified by:
isTraceEnabled in class Logger
Returns:
boolean
See Also:
Logger.isTraceEnabled()


Copyright © 2002-2004 Robert Half International. All Rights Reserved.