mazz.i18n.log4j
Class Log4jLogger

java.lang.Object
  extended by mazz.i18n.Logger
      extended by mazz.i18n.log4j.Log4jLogger

public class Log4jLogger
extends Logger

Similar in functionality to the Log4jLogMsg utility class, this provides the ability to log messages that are retrieved from a resource bundle with the additional capability of being able to set the base bundle name and locale that this logger will use to log the message. If the locale is not specified or null, the LoggerLocale will be used to determine what locale will be used.

Version:
$Revision: 1.2 $
Author:
John Mazzitelli

Field Summary
 
Fields inherited from class mazz.i18n.Logger
SYSPROP_DUMP_LOG_KEYS, SYSPROP_DUMP_STACK_TRACES
 
Constructor Summary
Log4jLogger(java.lang.Class clazz)
           
Log4jLogger(java.lang.Class clazz, java.util.Locale locale)
           
Log4jLogger(java.lang.Class clazz, Msg.BundleBaseName basename)
           
Log4jLogger(java.lang.Class clazz, Msg.BundleBaseName basename, java.util.Locale locale)
           
Log4jLogger(java.lang.String name)
           
Log4jLogger(java.lang.String name, java.util.Locale locale)
           
Log4jLogger(java.lang.String name, Msg.BundleBaseName basename)
           
Log4jLogger(java.lang.String name, Msg.BundleBaseName basename, java.util.Locale locale)
           
 
Method Summary
protected  void createLogObject(java.lang.Class clazz)
          Creates the Commons-Logging log object.
protected  void createLogObject(java.lang.String name)
          Creates the Commons-Logging log object.
 Msg debug(java.lang.String key, java.lang.Object... varargs)
          Calls Log4jLogMsg.debug(org.apache.log4j.Logger, Msg.BundleBaseName, Locale, String, Object[]) to log the message.
 Msg debug(java.lang.Throwable throwable, java.lang.String key, java.lang.Object... varargs)
          Calls Log4jLogMsg.debug(org.apache.log4j.Logger, Throwable, Msg.BundleBaseName, Locale, String, Object[]) to log the message.
 Msg error(java.lang.String key, java.lang.Object... varargs)
          Calls Log4jLogMsg.error(org.apache.log4j.Logger, Msg.BundleBaseName, Locale, String, Object[]) to log the message.
 Msg error(java.lang.Throwable throwable, java.lang.String key, java.lang.Object... varargs)
          Calls Log4jLogMsg.error(org.apache.log4j.Logger, Throwable, Msg.BundleBaseName, Locale, String, Object[]) to log the message.
 Msg fatal(java.lang.String key, java.lang.Object... varargs)
          Calls Log4jLogMsg.fatal(org.apache.log4j.Logger, Msg.BundleBaseName, Locale, String, Object[]) to log the message.
 Msg fatal(java.lang.Throwable throwable, java.lang.String key, java.lang.Object... varargs)
          Calls Log4jLogMsg.fatal(org.apache.log4j.Logger, Throwable, Msg.BundleBaseName, Locale, String, Object[]) to log the message.
 Msg info(java.lang.String key, java.lang.Object... varargs)
          Calls Log4jLogMsg.info(org.apache.log4j.Logger, Msg.BundleBaseName, Locale, String, Object[]) to log the message.
 Msg info(java.lang.Throwable throwable, java.lang.String key, java.lang.Object... varargs)
          Calls Log4jLogMsg.info(org.apache.log4j.Logger, Throwable, Msg.BundleBaseName, Locale, String, Object[]) to log the message.
 boolean isDebugEnabled()
          Returns true if the debug log level is enabled
 boolean isErrorEnabled()
          Log4J's design philosophy is that this method should never be needed.
 boolean isFatalEnabled()
          Log4J's design philosophy is that this method should never be needed.
 boolean isInfoEnabled()
          Returns true if the info log level is enabled
 boolean isTraceEnabled()
          Returns true if the trace log level is enabled
 boolean isWarnEnabled()
          Log4J's design philosophy is that this method should never be needed.
 Msg trace(java.lang.String key, java.lang.Object... varargs)
          Calls Log4jLogMsg.trace(org.apache.log4j.Logger, Msg.BundleBaseName, Locale, String, Object[]) to log the message.
 Msg trace(java.lang.Throwable throwable, java.lang.String key, java.lang.Object... varargs)
          Calls Log4jLogMsg.trace(org.apache.log4j.Logger, Throwable, Msg.BundleBaseName, Locale, String, Object[]) to log the message.
 Msg warn(java.lang.String key, java.lang.Object... varargs)
          Calls Log4jLogMsg.warn(org.apache.log4j.Logger, Msg.BundleBaseName, Locale, String, Object[]) to log the message.
 Msg warn(java.lang.Throwable throwable, java.lang.String key, java.lang.Object... varargs)
          Calls Log4jLogMsg.warn(org.apache.log4j.Logger, Throwable, Msg.BundleBaseName, Locale, String, Object[]) to log the message.
 
Methods inherited from class mazz.i18n.Logger
getBaseBundleName, getDumpLogKeys, getDumpStackTraces, getLocale, getMsg, getMsgString, setDumpLogKeys, setDumpStackTraces
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Log4jLogger

public Log4jLogger(java.lang.String name,
                   Msg.BundleBaseName basename,
                   java.util.Locale locale)
See Also:
Logger.Logger(String, Msg.BundleBaseName, Locale)

Log4jLogger

public Log4jLogger(java.lang.Class clazz,
                   Msg.BundleBaseName basename,
                   java.util.Locale locale)
See Also:
Logger.Logger(Class, Msg.BundleBaseName, Locale)

Log4jLogger

public Log4jLogger(java.lang.String name,
                   Msg.BundleBaseName basename)
See Also:
Logger.Logger(String, Msg.BundleBaseName)

Log4jLogger

public Log4jLogger(java.lang.Class clazz,
                   Msg.BundleBaseName basename)
See Also:
Logger.Logger(Class, Msg.BundleBaseName)

Log4jLogger

public Log4jLogger(java.lang.String name,
                   java.util.Locale locale)
See Also:
Logger.Logger(String, Locale)

Log4jLogger

public Log4jLogger(java.lang.Class clazz,
                   java.util.Locale locale)
See Also:
Logger.Logger(Class, Locale)

Log4jLogger

public Log4jLogger(java.lang.String name)
See Also:
Logger.Logger(String)

Log4jLogger

public Log4jLogger(java.lang.Class clazz)
See Also:
Logger.Logger(Class)
Method Detail

isFatalEnabled

public boolean isFatalEnabled()
Log4J's design philosophy is that this method should never be needed. This method is here to comply with i18nlog's API contract; however, this method will always return true.

Specified by:
isFatalEnabled in class Logger
Returns:
enabled flag
See Also:
Logger.isFatalEnabled()

isErrorEnabled

public boolean isErrorEnabled()
Log4J's design philosophy is that this method should never be needed. This method is here to comply with i18nlog's API contract; however, this method will always return true.

Specified by:
isErrorEnabled in class Logger
Returns:
enabled flag
See Also:
Logger.isErrorEnabled()

isWarnEnabled

public boolean isWarnEnabled()
Log4J's design philosophy is that this method should never be needed. This method is here to comply with i18nlog's API contract; however, this method will always return true.

Specified by:
isWarnEnabled in class Logger
Returns:
enabled flag
See Also:
Logger.isWarnEnabled()

isInfoEnabled

public boolean isInfoEnabled()
Description copied from class: Logger
Returns true if the info log level is enabled

Specified by:
isInfoEnabled in class Logger
Returns:
enabled flag
See Also:
Logger.isInfoEnabled()

isDebugEnabled

public boolean isDebugEnabled()
Description copied from class: Logger
Returns true if the debug log level is enabled

Specified by:
isDebugEnabled in class Logger
Returns:
enabled flag
See Also:
Logger.isDebugEnabled()

isTraceEnabled

public boolean isTraceEnabled()
Description copied from class: Logger
Returns true if the trace log level is enabled

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

fatal

public Msg fatal(java.lang.Throwable throwable,
                 java.lang.String key,
                 java.lang.Object... varargs)
Calls Log4jLogMsg.fatal(org.apache.log4j.Logger, Throwable, Msg.BundleBaseName, Locale, String, Object[]) to log the message.

Specified by:
fatal in class Logger
Parameters:
throwable - the throwable to log
key - the resource bundle key of the message to log
varargs - the resource bundle message arguments
Returns:
the resource bundle message that was logged
See Also:
Logger.fatal(Throwable, String, Object[])

fatal

public Msg fatal(java.lang.String key,
                 java.lang.Object... varargs)
Calls Log4jLogMsg.fatal(org.apache.log4j.Logger, Msg.BundleBaseName, Locale, String, Object[]) to log the message.

Specified by:
fatal in class Logger
Parameters:
key - the resource bundle key of the message to log
varargs - the resource bundle message arguments
Returns:
the resource bundle message that was logged
See Also:
Logger.fatal(String, Object[])

error

public Msg error(java.lang.Throwable throwable,
                 java.lang.String key,
                 java.lang.Object... varargs)
Calls Log4jLogMsg.error(org.apache.log4j.Logger, Throwable, Msg.BundleBaseName, Locale, String, Object[]) to log the message.

Specified by:
error in class Logger
Parameters:
throwable - the throwable to log
key - the resource bundle key of the message to log
varargs - the resource bundle message arguments
Returns:
the resource bundle message that was logged
See Also:
Logger.error(Throwable, String, Object[])

error

public Msg error(java.lang.String key,
                 java.lang.Object... varargs)
Calls Log4jLogMsg.error(org.apache.log4j.Logger, Msg.BundleBaseName, Locale, String, Object[]) to log the message.

Specified by:
error in class Logger
Parameters:
key - the resource bundle key of the message to log
varargs - the resource bundle message arguments
Returns:
the resource bundle message that was logged
See Also:
Logger.error(String, Object[])

warn

public Msg warn(java.lang.Throwable throwable,
                java.lang.String key,
                java.lang.Object... varargs)
Calls Log4jLogMsg.warn(org.apache.log4j.Logger, Throwable, Msg.BundleBaseName, Locale, String, Object[]) to log the message.

Specified by:
warn in class Logger
Parameters:
throwable - the throwable to log
key - the resource bundle key of the message to log
varargs - the resource bundle message arguments
Returns:
the resource bundle message that was logged
See Also:
Logger.warn(Throwable, String, Object[])

warn

public Msg warn(java.lang.String key,
                java.lang.Object... varargs)
Calls Log4jLogMsg.warn(org.apache.log4j.Logger, Msg.BundleBaseName, Locale, String, Object[]) to log the message.

Specified by:
warn in class Logger
Parameters:
key - the resource bundle key of the message to log
varargs - the resource bundle message arguments
Returns:
the resource bundle message that was logged
See Also:
Logger.warn(String, Object[])

info

public Msg info(java.lang.Throwable throwable,
                java.lang.String key,
                java.lang.Object... varargs)
Calls Log4jLogMsg.info(org.apache.log4j.Logger, Throwable, Msg.BundleBaseName, Locale, String, Object[]) to log the message.

Specified by:
info in class Logger
Parameters:
throwable - the throwable to log
key - the resource bundle key of the message to log
varargs - the resource bundle message arguments
Returns:
the resource bundle message that was logged
See Also:
Logger.info(Throwable, String, Object[])

info

public Msg info(java.lang.String key,
                java.lang.Object... varargs)
Calls Log4jLogMsg.info(org.apache.log4j.Logger, Msg.BundleBaseName, Locale, String, Object[]) to log the message.

Specified by:
info in class Logger
Parameters:
key - the resource bundle key of the message to log
varargs - the resource bundle message arguments
Returns:
the resource bundle message that was logged
See Also:
Logger.info(String, Object[])

debug

public Msg debug(java.lang.Throwable throwable,
                 java.lang.String key,
                 java.lang.Object... varargs)
Calls Log4jLogMsg.debug(org.apache.log4j.Logger, Throwable, Msg.BundleBaseName, Locale, String, Object[]) to log the message.

Specified by:
debug in class Logger
Parameters:
throwable - the throwable to log
key - the resource bundle key of the message to log
varargs - the resource bundle message arguments
Returns:
the resource bundle message that was logged
See Also:
Logger.debug(Throwable, String, Object[])

debug

public Msg debug(java.lang.String key,
                 java.lang.Object... varargs)
Calls Log4jLogMsg.debug(org.apache.log4j.Logger, Msg.BundleBaseName, Locale, String, Object[]) to log the message.

Specified by:
debug in class Logger
Parameters:
key - the resource bundle key of the message to log
varargs - the resource bundle message arguments
Returns:
the resource bundle message that was logged
See Also:
Logger.debug(String, Object[])

trace

public Msg trace(java.lang.Throwable throwable,
                 java.lang.String key,
                 java.lang.Object... varargs)
Calls Log4jLogMsg.trace(org.apache.log4j.Logger, Throwable, Msg.BundleBaseName, Locale, String, Object[]) to log the message.

Specified by:
trace in class Logger
Parameters:
throwable - the throwable to log
key - the resource bundle key of the message to log
varargs - the resource bundle message arguments
Returns:
the resource bundle message that was logged
See Also:
Logger.trace(Throwable, String, Object[])

trace

public Msg trace(java.lang.String key,
                 java.lang.Object... varargs)
Calls Log4jLogMsg.trace(org.apache.log4j.Logger, Msg.BundleBaseName, Locale, String, Object[]) to log the message.

Specified by:
trace in class Logger
Parameters:
key - the resource bundle key of the message to log
varargs - the resource bundle message arguments
Returns:
the resource bundle message that was logged
See Also:
Logger.trace(String, Object[])

createLogObject

protected void createLogObject(java.lang.Class clazz)
Creates the Commons-Logging log object.

Specified by:
createLogObject in class Logger
Parameters:
clazz - the class to associate with the log object that is to be created
See Also:
Logger.createLogObject(Class)

createLogObject

protected void createLogObject(java.lang.String name)
Creates the Commons-Logging log object.

Specified by:
createLogObject in class Logger
Parameters:
name - the name to associate with the log object that is to be created
See Also:
Logger.createLogObject(String)


Copyright © 2006 John J. Mazzitelli All Rights Reserved. Licensed under LGPL