org.norther.tammi.acorn.logger.log
Class DefaultLog

java.lang.Object
  extended by org.slf4j.helpers.MarkerIgnoringBase
      extended by org.norther.tammi.acorn.logger.log.DefaultLog
All Implemented Interfaces:
Serializable, EventListener, Log, LoggerListener, org.slf4j.Logger
Direct Known Subclasses:
DomainLog

public class DefaultLog
extends org.slf4j.helpers.MarkerIgnoringBase
implements Log, LoggerListener, Serializable

A default implementation of Log writing messages to System.out and System.err.

Version:
$Id: DefaultLog.java,v 1.23 2010-03-23 14:45:35 cvsimp Exp $
Author:
Ilkka Priha
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.norther.tammi.acorn.logger.log.Log
Log.Level
 
Field Summary
protected  String name
           
 
Fields inherited from interface org.norther.tammi.acorn.logger.log.Log
INTERNAL_ERROR
 
Fields inherited from interface org.slf4j.Logger
ROOT_LOGGER_NAME
 
Constructor Summary
DefaultLog()
          Constructs a new log.
DefaultLog(String n)
          Constructs a new log for a named logger.
 
Method Summary
 void access(long time, String msg, Object arg)
          Logs an access message.
 void activated(LoggerEvent event)
          Notifies the object that it has been activated for a logger.
 void debug(Object msg)
          Logs a debug message.
 void debug(String msg)
           
 void debug(String msg, Object arg)
          Logs a debug message with an argument.
 void debug(String msg, Object[] args)
           
 void debug(String msg, Object arg1, Object arg2)
           
 void debug(String msg, Throwable t)
           
 void error(Object msg)
          Logs an error message.
 void error(String msg)
           
 void error(String msg, Object arg)
          Logs an error message with an argument.
 void error(String msg, Object[] args)
           
 void error(String msg, Object arg1, Object arg2)
           
 void error(String msg, Object arg, Throwable cause)
          Logs an error message with an argument and reason.
 void error(String msg, Throwable t)
           
 void fatal(Object msg)
          Logs a fatal message.
 void fatal(String msg, Object arg)
          Logs a fatal message with an argument.
 void fatal(String msg, Object arg, Throwable cause)
          Logs a fatal message with an argument and reason.
 void fatal(String msg, Throwable cause)
          Logs a fatal message with a reason.
 Throwable getCause(Throwable cause)
          Gets the relevant cause of the specified throwable.
 Object getContext()
          Gets the context of this log.
 Log.Level getLevel()
          Gets the log level.
protected  Localizer getLocalizer()
          Gets the localizer.
protected  LogFactory getLogFactory()
          Gets the log factory.
 Object getLogger()
          Gets the logger of this log.
 String getLoggerName()
          Gets the logger name of this log.
 String getName()
           
 void info(Object msg)
          Logs an info message.
 void info(String msg)
           
 void info(String msg, Object arg)
          Logs an info message with an argument.
 void info(String msg, Object[] args)
           
 void info(String msg, Object arg1, Object arg2)
           
 void info(String msg, Throwable t)
           
 boolean isAccessEnabled()
          Checks whether access is enabled.
 boolean isActive()
          Checks whether this log is activated.
 boolean isDebugEnabled()
          Checks whether debug is enabled.
 boolean isErrorEnabled()
          Checks whether error is enabled.
 boolean isFatalEnabled()
          Checks whether fatal is enabled.
 boolean isInfoEnabled()
          Checks whether info is enabled.
 boolean isLogEnabled(Log.Level level)
          Checks whether the specified level is enabled.
 boolean isTraceEnabled()
          Checks whether trace is enabled.
 boolean isWarnEnabled()
          Checks whether warn is enabled.
 String localize(Throwable target, Object... localization)
          Localizes the specified exception.
 void log(Log.Level level, long time, String msg, Object arg)
          Logs a message with a specific level, date and argument.
 void log(Log.Level level, long time, String msg, Object arg, Throwable cause)
          Logs a message with a specific level, date, argument and reason.
 void log(Log.Level level, long time, String msg, Throwable cause)
          Logs a message with a specific level, date and reason.
 void log(Log.Level level, Object msg)
          Logs a message with a specific level.
 void log(Log.Level level, String msg, Object arg)
          Logs a message with a specific level and argument.
 void log(Log.Level level, String msg, Object arg, Throwable cause)
          Logs a message with a specific level, argument and reason.
 void log(Log.Level level, String msg, Throwable cause)
          Logs a message with a specific level and reason.
protected  Object readResolve()
           
 void trace(Object msg)
          Logs a trace message.
 void trace(String msg)
           
 void trace(String msg, Object arg)
          Logs a trace message with an argument.
 void trace(String msg, Object[] args)
           
 void trace(String msg, Object arg1, Object arg2)
           
 void trace(String msg, Throwable t)
           
 void warn(Object msg)
          Logs a warn message.
 void warn(String msg)
           
 void warn(String msg, Object arg)
          Logs a warn message with an argument.
 void warn(String msg, Object[] args)
           
 void warn(String msg, Object arg1, Object arg2)
           
 void warn(String msg, Object arg, Throwable cause)
          Logs a warn message with an argument and reason.
 void warn(String msg, Throwable t)
           
 
Methods inherited from class org.slf4j.helpers.MarkerIgnoringBase
debug, debug, debug, debug, debug, error, error, error, error, error, info, info, info, info, info, isDebugEnabled, isErrorEnabled, isInfoEnabled, isTraceEnabled, isWarnEnabled, toString, trace, trace, trace, trace, trace, warn, warn, warn, warn, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.slf4j.Logger
debug, debug, debug, debug, debug, error, error, error, error, error, getName, info, info, info, info, info, isDebugEnabled, isErrorEnabled, isInfoEnabled, isTraceEnabled, isWarnEnabled, trace, trace, trace, trace, trace, warn, warn, warn, warn, warn
 

Field Detail

name

protected String name
Constructor Detail

DefaultLog

public DefaultLog()
Constructs a new log.


DefaultLog

public DefaultLog(String n)
Constructs a new log for a named logger.

Parameters:
n - the logger name.
Method Detail

isTraceEnabled

public boolean isTraceEnabled()
Description copied from interface: Log
Checks whether trace is enabled.

Specified by:
isTraceEnabled in interface Log
Specified by:
isTraceEnabled in interface org.slf4j.Logger
Returns:
true if enabled, false otherwise.

isDebugEnabled

public boolean isDebugEnabled()
Description copied from interface: Log
Checks whether debug is enabled.

Specified by:
isDebugEnabled in interface Log
Specified by:
isDebugEnabled in interface org.slf4j.Logger
Returns:
true if enabled, false otherwise.

isInfoEnabled

public boolean isInfoEnabled()
Description copied from interface: Log
Checks whether info is enabled.

Specified by:
isInfoEnabled in interface Log
Specified by:
isInfoEnabled in interface org.slf4j.Logger
Returns:
true if enabled, false otherwise.

isWarnEnabled

public boolean isWarnEnabled()
Description copied from interface: Log
Checks whether warn is enabled.

Specified by:
isWarnEnabled in interface Log
Specified by:
isWarnEnabled in interface org.slf4j.Logger
Returns:
true if enabled, false otherwise.

isErrorEnabled

public boolean isErrorEnabled()
Description copied from interface: Log
Checks whether error is enabled.

Specified by:
isErrorEnabled in interface Log
Specified by:
isErrorEnabled in interface org.slf4j.Logger
Returns:
true if enabled, false otherwise.

isFatalEnabled

public boolean isFatalEnabled()
Description copied from interface: Log
Checks whether fatal is enabled.

Specified by:
isFatalEnabled in interface Log
Returns:
true if enabled, false otherwise.

isAccessEnabled

public boolean isAccessEnabled()
Description copied from interface: Log
Checks whether access is enabled.

Specified by:
isAccessEnabled in interface Log
Returns:
true if enabled, false otherwise.

isLogEnabled

public boolean isLogEnabled(Log.Level level)
Description copied from interface: Log
Checks whether the specified level is enabled.

Specified by:
isLogEnabled in interface Log
Parameters:
level - the logging level.
Returns:
true if enabled, false otherwise.

getLevel

public Log.Level getLevel()
Description copied from interface: Log
Gets the log level.

Specified by:
getLevel in interface Log
Returns:
the logging level.

trace

public void trace(Object msg)
Description copied from interface: Log
Logs a trace message.

Specified by:
trace in interface Log
Parameters:
msg - the message to log.

trace

public void trace(String msg)
Specified by:
trace in interface org.slf4j.Logger

trace

public void trace(String msg,
                  Object arg)
Description copied from interface: Log
Logs a trace message with an argument.

Specified by:
trace in interface Log
Specified by:
trace in interface org.slf4j.Logger
Parameters:
msg - the message to log.
arg - the argument or cause.

trace

public void trace(String msg,
                  Throwable t)
Specified by:
trace in interface org.slf4j.Logger

trace

public void trace(String msg,
                  Object arg1,
                  Object arg2)
Specified by:
trace in interface org.slf4j.Logger

trace

public void trace(String msg,
                  Object[] args)
Specified by:
trace in interface org.slf4j.Logger

debug

public void debug(Object msg)
Description copied from interface: Log
Logs a debug message.

Specified by:
debug in interface Log
Parameters:
msg - the message to log.

debug

public void debug(String msg)
Specified by:
debug in interface org.slf4j.Logger

debug

public void debug(String msg,
                  Object arg)
Description copied from interface: Log
Logs a debug message with an argument.

Specified by:
debug in interface Log
Specified by:
debug in interface org.slf4j.Logger
Parameters:
msg - the message to log.
arg - the argument or cause.

debug

public void debug(String msg,
                  Throwable t)
Specified by:
debug in interface org.slf4j.Logger

debug

public void debug(String msg,
                  Object arg1,
                  Object arg2)
Specified by:
debug in interface org.slf4j.Logger

debug

public void debug(String msg,
                  Object[] args)
Specified by:
debug in interface org.slf4j.Logger

info

public void info(Object msg)
Description copied from interface: Log
Logs an info message.

Specified by:
info in interface Log
Parameters:
msg - the message to log.

info

public void info(String msg)
Specified by:
info in interface org.slf4j.Logger

info

public void info(String msg,
                 Object arg)
Description copied from interface: Log
Logs an info message with an argument.

Specified by:
info in interface Log
Specified by:
info in interface org.slf4j.Logger
Parameters:
msg - the message to log.
arg - the argument or cause.

info

public void info(String msg,
                 Throwable t)
Specified by:
info in interface org.slf4j.Logger

info

public void info(String msg,
                 Object arg1,
                 Object arg2)
Specified by:
info in interface org.slf4j.Logger

info

public void info(String msg,
                 Object[] args)
Specified by:
info in interface org.slf4j.Logger

warn

public void warn(Object msg)
Description copied from interface: Log
Logs a warn message.

Specified by:
warn in interface Log
Parameters:
msg - the message to log.

warn

public void warn(String msg)
Specified by:
warn in interface org.slf4j.Logger

warn

public void warn(String msg,
                 Object arg)
Description copied from interface: Log
Logs a warn message with an argument.

Specified by:
warn in interface Log
Specified by:
warn in interface org.slf4j.Logger
Parameters:
msg - the message to log.
arg - the argument or cause.

warn

public void warn(String msg,
                 Object arg,
                 Throwable cause)
Description copied from interface: Log
Logs a warn message with an argument and reason.

Specified by:
warn in interface Log
Parameters:
msg - the message to log.
arg - the argument.
cause - the cause.

warn

public void warn(String msg,
                 Throwable t)
Specified by:
warn in interface org.slf4j.Logger

warn

public void warn(String msg,
                 Object arg1,
                 Object arg2)
Specified by:
warn in interface org.slf4j.Logger

warn

public void warn(String msg,
                 Object[] args)
Specified by:
warn in interface org.slf4j.Logger

error

public void error(Object msg)
Description copied from interface: Log
Logs an error message.

Specified by:
error in interface Log
Parameters:
msg - the message to log.

error

public void error(String msg)
Specified by:
error in interface org.slf4j.Logger

error

public void error(String msg,
                  Object arg)
Description copied from interface: Log
Logs an error message with an argument.

Specified by:
error in interface Log
Specified by:
error in interface org.slf4j.Logger
Parameters:
msg - the message to log.
arg - the argument or cause.

error

public void error(String msg,
                  Object arg,
                  Throwable cause)
Description copied from interface: Log
Logs an error message with an argument and reason.

Specified by:
error in interface Log
Parameters:
msg - the message to log.
arg - the argument.
cause - the cause.

error

public void error(String msg,
                  Throwable t)
Specified by:
error in interface org.slf4j.Logger

error

public void error(String msg,
                  Object arg1,
                  Object arg2)
Specified by:
error in interface org.slf4j.Logger

error

public void error(String msg,
                  Object[] args)
Specified by:
error in interface org.slf4j.Logger

fatal

public void fatal(Object msg)
Description copied from interface: Log
Logs a fatal message.

Specified by:
fatal in interface Log
Parameters:
msg - the message to log.

fatal

public void fatal(String msg,
                  Object arg)
Description copied from interface: Log
Logs a fatal message with an argument.

Specified by:
fatal in interface Log
Parameters:
msg - the message to log.
arg - the argument or cause.

fatal

public void fatal(String msg,
                  Throwable cause)
Description copied from interface: Log
Logs a fatal message with a reason.

Specified by:
fatal in interface Log
Parameters:
msg - the message to log.
cause - the cause.

fatal

public void fatal(String msg,
                  Object arg,
                  Throwable cause)
Description copied from interface: Log
Logs a fatal message with an argument and reason.

Specified by:
fatal in interface Log
Parameters:
msg - the message to log.
arg - the argument.
cause - the cause.

access

public void access(long time,
                   String msg,
                   Object arg)
Description copied from interface: Log
Logs an access message.

Specified by:
access in interface Log
Parameters:
time - the time of the event.
msg - the message to log.
arg - the argument.

log

public void log(Log.Level level,
                Object msg)
Description copied from interface: Log
Logs a message with a specific level.

Specified by:
log in interface Log
Parameters:
level - the level of the message.
msg - the message to log.

log

public void log(Log.Level level,
                String msg,
                Object arg)
Description copied from interface: Log
Logs a message with a specific level and argument.

Specified by:
log in interface Log
Parameters:
level - the level of the message.
msg - the message to log.
arg - the argument or cause.

log

public void log(Log.Level level,
                String msg,
                Throwable cause)
Description copied from interface: Log
Logs a message with a specific level and reason.

Specified by:
log in interface Log
Parameters:
level - the level of the message.
msg - the message to log.
cause - the cause.

log

public void log(Log.Level level,
                String msg,
                Object arg,
                Throwable cause)
Description copied from interface: Log
Logs a message with a specific level, argument and reason.

Specified by:
log in interface Log
Parameters:
level - the level of the message.
msg - the message to log.
arg - the argument.
cause - the cause.

log

public void log(Log.Level level,
                long time,
                String msg,
                Object arg)
Description copied from interface: Log
Logs a message with a specific level, date and argument.

Specified by:
log in interface Log
Parameters:
level - the level of the message.
time - the time of the event.
msg - the message to log.
arg - the argument or cause.

log

public void log(Log.Level level,
                long time,
                String msg,
                Throwable cause)
Description copied from interface: Log
Logs a message with a specific level, date and reason.

Specified by:
log in interface Log
Parameters:
level - the level of the message.
time - the time of the event.
msg - the message to log.
cause - the cause.

log

public void log(Log.Level level,
                long time,
                String msg,
                Object arg,
                Throwable cause)
Description copied from interface: Log
Logs a message with a specific level, date, argument and reason.

Specified by:
log in interface Log
Parameters:
level - the level of the message.
time - the time of the event.
msg - the message to log.
arg - the argument.
cause - the cause.

localize

public String localize(Throwable target,
                       Object... localization)
Description copied from interface: Log
Localizes the specified exception. The localization may contain any combination of a localizer, a locale and an argument

The message is constructed by using the exception type and non-localized message as a key for the localized message. If such a message can't be found, the plain exception type is used as the key. If such a message is found and it ends with a colon, the non-localized message is appended to it. If such a message is not found, the non-localized message is returned unmodified.

Specified by:
localize in interface Log
Parameters:
target - the exception.
localization - the localization.
Returns:
the localized message.

getLoggerName

public String getLoggerName()
Description copied from interface: Log
Gets the logger name of this log.

Specified by:
getLoggerName in interface Log
Returns:
the logger name.

getLogger

public Object getLogger()
Description copied from interface: Log
Gets the logger of this log.

Specified by:
getLogger in interface Log
Returns:
the logger.

getContext

public Object getContext()
Description copied from interface: Log
Gets the context of this log.

Specified by:
getContext in interface Log
Returns:
the context.

getCause

public Throwable getCause(Throwable cause)
Description copied from interface: Log
Gets the relevant cause of the specified throwable.

Specified by:
getCause in interface Log
Parameters:
cause - the cause throwable.
Returns:
the relevat cause.

isActive

public boolean isActive()
Description copied from interface: Log
Checks whether this log is activated.

Specified by:
isActive in interface Log
Returns:
true if activated, false otherwise.

activated

public void activated(LoggerEvent event)
Description copied from interface: LoggerListener
Notifies the object that it has been activated for a logger.

Specified by:
activated in interface LoggerListener
Parameters:
event - the logger event.

getLogFactory

protected LogFactory getLogFactory()
Gets the log factory.

Returns:
the log factory or null.

getLocalizer

protected Localizer getLocalizer()
Gets the localizer.

Returns:
the localizer or null.

getName

public String getName()
Specified by:
getName in interface org.slf4j.Logger

readResolve

protected Object readResolve()
                      throws ObjectStreamException
Throws:
ObjectStreamException


Copyright © 2004 The Norther Organization. All rights reserved.