raccoon.core.log
Class Log4jProxy

java.lang.Object
  extended by raccoon.core.types.AbsComponent
      extended by raccoon.core.types.AbsLoadable
          extended by raccoon.core.types.AbsConfigurableLoadable
              extended by raccoon.core.log.AbsLogComponent
                  extended by raccoon.core.log.Log4jProxy
All Implemented Interfaces:
ILogger, IBaseComponent, IConfigurable, ILoadable, ILogable

public final class Log4jProxy
extends AbsLogComponent
implements ILogger

Wrapper around the IBM Log4j implementation. This implementation has now moved to the Apache project and is packaged as org.apache.log4j.

A typical properties file would look like this:
log4j.appender.Raccoon = org.apache.log4j.RollingFileAppender
log4j.appender.Raccoon.File = Raccoon.log
log4j.appender.Raccoon.Append = false
log4j.appender.Raccoon.MaxFileSize = 5MB
log4j.appender.Raccoon.MaxBackupIndex = 10
log4j.appender.Raccoon.layout = org.apache.log4j.PatternLayout
log4j.appender.Raccoon.layout.ConversionPattern = %r [%t] %-5p %c{2} %x - %m %n

log4j.rootLogger=debug, Raccoon

Since:
Raccoon v0.2, refactored in Raccoon v0.5 & v0.8
Version:
$Id: Log4jProxy.java,v 1.1 2004/08/08 20:19:17 crouvrais Exp $
Author:
Cedric ROUVRAIS

Field Summary
 
Fields inherited from class raccoon.core.log.AbsLogComponent
LOGGER_NAME, mLoggerName, mPropertyFileName, PROPERTY_FILE_NAME
 
Fields inherited from class raccoon.core.types.AbsConfigurableLoadable
mConfigurableManager
 
Fields inherited from class raccoon.core.types.AbsLoadable
mIsLoaded
 
Fields inherited from class raccoon.core.types.AbsComponent
mIsInError
 
Fields inherited from interface raccoon.api.log.ILogger
LEVEL_DEBUG, LEVEL_ERROR, LEVEL_INFO, LEVEL_WARN, PTY_LOGGER
 
Constructor Summary
Log4jProxy()
           
 
Method Summary
 void configureParameters()
          Configures the various parameters for this component.
 void debug(java.lang.String pMessage)
          Inserts a String into the log only if the DEBUG level is enabled
 void debug(java.lang.String pMessage, java.lang.Object[] pParams)
          Inserts a String into the log only if the DEBUG level is enabled.
 void debug(java.lang.String pMessage, java.lang.Object[] pParams, java.lang.Throwable pThrowable)
          Inserts a String and an Exception into the log only if the DEBUG level is enabled
 void debug(java.lang.String pMessage, java.lang.Throwable pThrowable)
          Inserts a String and an Exception into the log only if the DEBUG level is enabled
 java.lang.String debugLevelToString()
          The debug level as a string
 void error(java.lang.String pMessage)
          Inserts a String into the log only if the ERROR level is enabled
 void error(java.lang.String pMessage, java.lang.Object[] pParams)
          Inserts a String into the log only if the ERROR level is enabled.
 void error(java.lang.String pMessage, java.lang.Object[] pParams, java.lang.Throwable pThrowable)
          Inserts a String and an Exception into the log only if the ERROR level is enabled
 void error(java.lang.String pMessage, java.lang.Throwable pThrowable)
          Inserts a String and an Exception into the log only if the ERROR level is enabled
 java.lang.String errorLevelToString()
          The error level as a string
protected  void getLogInstance()
          Instanciates the logging element.
 void info(java.lang.String pMessage)
          Inserts a String into the log only if the INFO level is enabled.
 void info(java.lang.String pMessage, java.lang.Object[] pParams)
          Inserts a String into the log only if the INFO level is enabled.
 void info(java.lang.String pMessage, java.lang.Object[] pParams, java.lang.Throwable pThrowable)
          Insert a String and an exception into the log only if the INFO level is enabled.
 void info(java.lang.String pMessage, java.lang.Throwable pThrowable)
          Inserts a String and an Exception into the log only if the INFO level is enabled.
 java.lang.String infoLevelToString()
          The info level as a string
 boolean isDebugEnabled()
          Checks if debug mode is enabled.
 boolean isErrorEnabled()
          Returns true if error mode is enabled.
 boolean isInfoEnabled()
          Checks if info mode is enabled.
 boolean isWarnEnabled()
          Returns true if warn mode is enabled.
protected  void loadLoggers()
          Loads the various loggers required to function.
 void warn(java.lang.String pMessage)
          Inserts a String into the log only if the WARN level is enabled
 void warn(java.lang.String pMessage, java.lang.Object[] pParams)
          Inserts a String into the log only if the WARN level is enabled.
 void warn(java.lang.String pMessage, java.lang.Object[] pParams, java.lang.Throwable pThrowable)
          Inserts a String and an Exception into the log only if the WARN level is enabled
 void warn(java.lang.String pMessage, java.lang.Throwable pThrowable)
          Inserts a String and an Exception into the log only if the WARN level is enabled
 java.lang.String warnLevelToString()
          The warn level as a string
 
Methods inherited from class raccoon.core.log.AbsLogComponent
getCallingClassLevel, getCategoryName, getLoggerName, getPropertyFileName, load, setCallingClassLevel, setCategoryName, setLoggerName, setPropertyFileName
 
Methods inherited from class raccoon.core.types.AbsConfigurableLoadable
isStable, setConfigurableManager, setLogger
 
Methods inherited from class raccoon.core.types.AbsLoadable
getLog, isInError, isInitialised, isRunning, unload
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface raccoon.api.log.ILogger
getCategoryName, getLoggerName, setCategoryName, setLoggerName
 

Constructor Detail

Log4jProxy

public Log4jProxy()
Method Detail

isDebugEnabled

public boolean isDebugEnabled()
Checks if debug mode is enabled. Use this method to avoid unnecessary String construction when calling the debug method.

Specified by:
isDebugEnabled in interface ILogger
Returns:
will use of debug produce some logs?

isInfoEnabled

public boolean isInfoEnabled()
Checks if info mode is enabled. Use this method to avoid unnecessary String construction when calling the info method.

Specified by:
isInfoEnabled in interface ILogger
Returns:
true if info mode is enabled

isWarnEnabled

public boolean isWarnEnabled()
Returns true if warn mode is enabled. Use this method to avoid unnecessary String construction when calling the warn method.

Specified by:
isWarnEnabled in interface ILogger
Returns:
true if warn mode is enabled

isErrorEnabled

public boolean isErrorEnabled()
Returns true if error mode is enabled. Use this method to avoid unnecessary String construction when calling the error method.

Specified by:
isErrorEnabled in interface ILogger
Returns:
true if error mode is enabled

configureParameters

public void configureParameters()
Configures the various parameters for this component. This method should configure the instance of IConfigurableManager provided during the invocation of AbsConfigurableLoadable.setConfigurableManager(raccoon.api.types.IConfigurableManager).

Specified by:
configureParameters in interface IConfigurable
Overrides:
configureParameters in class AbsConfigurableLoadable

getLogInstance

protected void getLogInstance()
Instanciates the logging element.

Specified by:
getLogInstance in class AbsLogComponent

loadLoggers

protected void loadLoggers()
                    throws LoadableException
Loads the various loggers required to function.

Specified by:
loadLoggers in class AbsLogComponent
Throws:
LoadableException - if the loggers couldn't be correctly loaded.

debugLevelToString

public java.lang.String debugLevelToString()
The debug level as a string

Specified by:
debugLevelToString in class AbsLogComponent
Returns:
debug string representation

infoLevelToString

public java.lang.String infoLevelToString()
The info level as a string

Specified by:
infoLevelToString in class AbsLogComponent
Returns:
info string representation

warnLevelToString

public java.lang.String warnLevelToString()
The warn level as a string

Specified by:
warnLevelToString in class AbsLogComponent
Returns:
warn string representation

errorLevelToString

public java.lang.String errorLevelToString()
The error level as a string

Specified by:
errorLevelToString in class AbsLogComponent
Returns:
error string representation

info

public void info(java.lang.String pMessage)
Inserts a String into the log only if the INFO level is enabled.

Specified by:
info in interface ILogger
Parameters:
pMessage - the message to log.

info

public void info(java.lang.String pMessage,
                 java.lang.Throwable pThrowable)
Inserts a String and an Exception into the log only if the INFO level is enabled.

Specified by:
info in interface ILogger
Parameters:
pMessage - the message to log.
pThrowable - the throwable to log.

info

public void info(java.lang.String pMessage,
                 java.lang.Object[] pParams)
Inserts a String into the log only if the INFO level is enabled. The String is of course a specific String, because each occurrence of {i} in that String will be replaced by Object[i].toString()
For example:
info("Hello {0}, you have {1}, new Object[] {"Kathleen", "mail"});
Should result be equivalent to the following call:
info("Hello Kathleen, you have mail");
No matter what the implementation behind the scenes.

Specified by:
info in interface ILogger
Parameters:
pMessage - the message to log.
pParams - a list of objects that implement the toString() method.

info

public void info(java.lang.String pMessage,
                 java.lang.Object[] pParams,
                 java.lang.Throwable pThrowable)
Insert a String and an exception into the log only if the INFO level is enabled.

Specified by:
info in interface ILogger
Parameters:
pMessage - the message to log.
pParams - a list of objects that implement the toString() method.
pThrowable - the throwable to log.
See Also:
info(String, Object[])

debug

public void debug(java.lang.String pMessage)
Inserts a String into the log only if the DEBUG level is enabled

Specified by:
debug in interface ILogger
Parameters:
pMessage - the message to log.

debug

public void debug(java.lang.String pMessage,
                  java.lang.Throwable pThrowable)
Inserts a String and an Exception into the log only if the DEBUG level is enabled

Specified by:
debug in interface ILogger
Parameters:
pMessage - the message to log.
pThrowable - the throwable to log.

debug

public void debug(java.lang.String pMessage,
                  java.lang.Object[] pParams)
Inserts a String into the log only if the DEBUG level is enabled.

Specified by:
debug in interface ILogger
Parameters:
pMessage - the message to log.
pParams - a list of objects that implement the toString() method.
See Also:
info(String, Object[])

debug

public void debug(java.lang.String pMessage,
                  java.lang.Object[] pParams,
                  java.lang.Throwable pThrowable)
Inserts a String and an Exception into the log only if the DEBUG level is enabled

Specified by:
debug in interface ILogger
Parameters:
pMessage - the message to log.
pParams - a list of objects that implement the toString() method.
pThrowable - the throwable to log.
See Also:
info(String, Object[], Throwable)

warn

public void warn(java.lang.String pMessage)
Inserts a String into the log only if the WARN level is enabled

Specified by:
warn in interface ILogger
Parameters:
pMessage - the message to log.

warn

public void warn(java.lang.String pMessage,
                 java.lang.Throwable pThrowable)
Inserts a String and an Exception into the log only if the WARN level is enabled

Specified by:
warn in interface ILogger
Parameters:
pThrowable - the throwable to log.
pMessage - the message to log.

warn

public void warn(java.lang.String pMessage,
                 java.lang.Object[] pParams)
Inserts a String into the log only if the WARN level is enabled.

Specified by:
warn in interface ILogger
Parameters:
pMessage - the message to log.
pParams - a list of objects that implement the toString() method.
See Also:
info(String, Object[])

warn

public void warn(java.lang.String pMessage,
                 java.lang.Object[] pParams,
                 java.lang.Throwable pThrowable)
Inserts a String and an Exception into the log only if the WARN level is enabled

Specified by:
warn in interface ILogger
Parameters:
pMessage - the message to log.
pParams - a list of objects that implement the toString() method.
pThrowable - the throwable to log.
See Also:
info(String, Object[], Throwable)

error

public void error(java.lang.String pMessage)
Inserts a String into the log only if the ERROR level is enabled

Specified by:
error in interface ILogger
Parameters:
pMessage - the message to log.

error

public void error(java.lang.String pMessage,
                  java.lang.Throwable pThrowable)
Inserts a String and an Exception into the log only if the ERROR level is enabled

Specified by:
error in interface ILogger
Parameters:
pThrowable - the throwable to log.
pMessage - the message to log.

error

public void error(java.lang.String pMessage,
                  java.lang.Object[] pParams)
Inserts a String into the log only if the ERROR level is enabled.

Specified by:
error in interface ILogger
Parameters:
pMessage - the message to log.
pParams - a list of objects that implement the toString() method.
See Also:
info(String, Object[])

error

public void error(java.lang.String pMessage,
                  java.lang.Object[] pParams,
                  java.lang.Throwable pThrowable)
Inserts a String and an Exception into the log only if the ERROR level is enabled

Specified by:
error in interface ILogger
Parameters:
pMessage - the message to log.
pParams - a list of objects that implement the toString() method.
pThrowable - the throwable to log.
See Also:
info(String, Object[], Throwable)


Copyright null null. All Rights Reserved.