net.sourceforge.acelogger
Class BaseLogger

java.lang.Object
  extended by net.sourceforge.acelogger.BaseLogger
All Implemented Interfaces:
Identifiable, Logger
Direct Known Subclasses:
GenericLogger, SimpleLogger

public abstract class BaseLogger
extends Object
implements Logger

Abstracts all common tasks for Logger.

Since:
1.0.0
Version:
1.0.0
Author:
Zardi (https://sourceforge.net/users/daniel_zardi)

Constructor Summary
protected BaseLogger(String identifier)
          Constructs a new BaseLogger using the supplied identifier, an empty appender, a "deny all" level filter and an empty location gatherer.
protected BaseLogger(String identifier, Appender appender, LevelFilter filter, LocationGatherer gatherer)
          Constructs a new BaseLogger using the supplied identifier, appender, level filter and location gatherer.
 
Method Summary
 void debug(String message, Object... params)
          Creates a debug level log message, the final message will depend on the underlying Formatter and parameters.
 void debug(String message, Throwable cause, Object... params)
          Creates a debug level log message, the final message will depend on the underlying Formatter and parameters.
 void error(String message, Object... params)
          Creates a error level log message, the final message will depend on the underlying Formatter and parameters.
 void error(String message, Throwable cause, Object... params)
          Creates a error level log message, the final message will depend on the underlying Formatter and parameters.
 void fatal(String message, Object... params)
          Creates a fatal level log message, the final message will depend on the underlying Formatter and parameters.
 void fatal(String message, Throwable cause, Object... params)
          Creates a fatal level log message, the final message will depend on the underlying Formatter and parameters.
protected  LogEvent generateLogCall(String message, Object[] params, LogLevel level)
          Generates a log call based on the supplied information.
protected  LogEvent generateLogCall(String message, Object[] params, LogLevel level, Throwable cause)
          Generates a log call based on the supplied information.
protected  LogEvent generateLogCall(String message, Object[] params, LogLevel level, Throwable cause, Thread currenThread)
          Generates a log call based on the supplied information.
 Appender getAppender()
          Returns the log appender used within this logger.
 LocationGatherer getGatherer()
          Returns the location gatherer used within this logger.
 String getIdentifier()
          Gets a String that identifies this object.
 LevelFilter getThreshold()
          Returns the level filter used within this logger.
 void info(String message, Object... params)
          Creates a information level log message, the final message will depend on the underlying Formatter.
 void info(String message, Throwable cause, Object... params)
          Creates a information level log message, the final message will depend on the underlying Formatter.
 boolean isDebugEnabled()
          Checks the suitability of the debug level for this Logger.
 boolean isErrorEnabled()
          Checks the suitability of the error level for this Logger.
 boolean isFatalEnabled()
          Checks the suitability of the fatal level for this Logger.
 boolean isInfoEnabled()
          Checks the suitability of the information level for this Logger.
 boolean isTraceEnabled()
          Checks the suitability of the tracing level for this Logger.
 boolean isWarnEnabled()
          Checks the suitability of the warning level for this Logger.
 void setGatherer(LocationGatherer gatherer)
          Sets the location gatherer used within this logger.
 void setThreshold(LevelFilter filter)
          Sets the level filter used within this logger.
 void trace(String message, Object... params)
          Creates a tracing level log message, the final message will depend on the underlying Formatter.
 void trace(String message, Throwable cause, Object... params)
          Creates a tracing level log message, the final message will depend on the underlying Formatter.
 void warn(String message, Object... params)
          Creates a warning level log message, the final message will depend on the underlying Formatter.
 void warn(String message, Throwable cause, Object... params)
          Creates a warning level log message, the final message will depend on the underlying Formatter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseLogger

protected BaseLogger(String identifier)
Constructs a new BaseLogger using the supplied identifier, an empty appender, a "deny all" level filter and an empty location gatherer.

Parameters:
identifier - A string that identifies this logger.
Since:
1.0.0

BaseLogger

protected BaseLogger(String identifier,
                     Appender appender,
                     LevelFilter filter,
                     LocationGatherer gatherer)
Constructs a new BaseLogger using the supplied identifier, appender, level filter and location gatherer.

Parameters:
identifier - A string that identifies this logger.
appender - The Appender that will be used within this logger.
filter - The LevelFilter that will be used within this logger.
gatherer - The LocationGatherer that will be used within this logger.
Since:
1.0.0
Method Detail

getThreshold

public final LevelFilter getThreshold()
Returns the level filter used within this logger.

Returns:
The LevelFilter used within this logger.
Since:
1.0.0

setThreshold

public final void setThreshold(LevelFilter filter)
Sets the level filter used within this logger.

Parameters:
filter - The LevelFilter that will be used within this logger.
Since:
1.0.0

getGatherer

public final LocationGatherer getGatherer()
Returns the location gatherer used within this logger.

Returns:
The LocationGatherer used within this logger.
Since:
1.0.0

setGatherer

public final void setGatherer(LocationGatherer gatherer)
Sets the location gatherer used within this logger.

Parameters:
gatherer - The LocationGatherer that will be used within this logger.
Since:
1.0.0

getIdentifier

public final String getIdentifier()
Gets a String that identifies this object.

Specified by:
getIdentifier in interface Identifiable
Returns:
The identifier of this object.

getAppender

public final Appender getAppender()
Returns the log appender used within this logger.

Returns:
The Appender used within this logger.
Since:
1.0.0

generateLogCall

protected final LogEvent generateLogCall(String message,
                                         Object[] params,
                                         LogLevel level)
Generates a log call based on the supplied information.

Parameters:
message - The message to be logged.
params - The parameters that should be available for formatting.
level - The level of the log call.
Returns:
A LogEvent generated with the supplied information.
Since:
1.0.0

generateLogCall

protected final LogEvent generateLogCall(String message,
                                         Object[] params,
                                         LogLevel level,
                                         Throwable cause)
Generates a log call based on the supplied information.

Parameters:
message - The message to be logged.
params - The parameters that should be available for formatting.
level - The level of the log call.
cause - The origin of the reported problem.
Returns:
A LogEvent generated with the supplied information.
Since:
1.0.0

generateLogCall

protected final LogEvent generateLogCall(String message,
                                         Object[] params,
                                         LogLevel level,
                                         Throwable cause,
                                         Thread currenThread)
Generates a log call based on the supplied information.

Parameters:
message - The message to be logged.
params - The parameters that should be available for formatting.
level - The level of the log call.
cause - The origin of the reported problem.
currenThread - The Thread where the log call was originated.
Returns:
A LogEvent generated with the supplied information.
Since:
1.0.0

isDebugEnabled

public final boolean isDebugEnabled()
Checks the suitability of the debug level for this Logger.

Specified by:
isDebugEnabled in interface Logger
Returns:
True if the debug level is suitable for this logger, false otherwise.

isErrorEnabled

public final boolean isErrorEnabled()
Checks the suitability of the error level for this Logger.

Specified by:
isErrorEnabled in interface Logger
Returns:
True if the error level is suitable for this logger, false otherwise.

isFatalEnabled

public final boolean isFatalEnabled()
Checks the suitability of the fatal level for this Logger.

Specified by:
isFatalEnabled in interface Logger
Returns:
True if the fatal level is suitable for this logger, false otherwise.

isInfoEnabled

public final boolean isInfoEnabled()
Checks the suitability of the information level for this Logger.

Specified by:
isInfoEnabled in interface Logger
Returns:
True if the information level is suitable for this logger, false otherwise.

isTraceEnabled

public final boolean isTraceEnabled()
Checks the suitability of the tracing level for this Logger.

Specified by:
isTraceEnabled in interface Logger
Returns:
True if the tracing level is suitable for this logger, false otherwise.

isWarnEnabled

public final boolean isWarnEnabled()
Checks the suitability of the warning level for this Logger.

Specified by:
isWarnEnabled in interface Logger
Returns:
True if the warning level is suitable for this logger, false otherwise.

debug

public final void debug(String message,
                        Object... params)
Creates a debug level log message, the final message will depend on the underlying Formatter and parameters.

Specified by:
debug in interface Logger
Parameters:
message - The message to be formatted and then logged.
params - The list of parameter used to format the message.

debug

public final void debug(String message,
                        Throwable cause,
                        Object... params)
Creates a debug level log message, the final message will depend on the underlying Formatter and parameters.

Specified by:
debug in interface Logger
Parameters:
message - The message to be formatted and then logged.
cause - The Throwable that originated this log call.
params - The list of parameter used to format the message.

error

public final void error(String message,
                        Object... params)
Creates a error level log message, the final message will depend on the underlying Formatter and parameters.

Specified by:
error in interface Logger
Parameters:
message - The message to be formatted and then logged.
params - The list of parameter used to format the message.

error

public final void error(String message,
                        Throwable cause,
                        Object... params)
Creates a error level log message, the final message will depend on the underlying Formatter and parameters.

Specified by:
error in interface Logger
Parameters:
message - The message to be formatted and then logged.
cause - The Throwable that originated this log call.
params - The list of parameter used to format the message.

fatal

public final void fatal(String message,
                        Object... params)
Creates a fatal level log message, the final message will depend on the underlying Formatter and parameters.

Specified by:
fatal in interface Logger
Parameters:
message - The message to be formatted and then logged.
params - The list of parameter used to format the message.

fatal

public final void fatal(String message,
                        Throwable cause,
                        Object... params)
Creates a fatal level log message, the final message will depend on the underlying Formatter and parameters.

Specified by:
fatal in interface Logger
Parameters:
message - The message to be formatted and then logged.
cause - The Throwable that originated this log call.
params - The list of parameter used to format the message.

info

public final void info(String message,
                       Object... params)
Creates a information level log message, the final message will depend on the underlying Formatter.

Specified by:
info in interface Logger
Parameters:
message - The message to be formatted and then logged.
params - The list of parameter used to format the message.

info

public final void info(String message,
                       Throwable cause,
                       Object... params)
Creates a information level log message, the final message will depend on the underlying Formatter.

Specified by:
info in interface Logger
Parameters:
message - The message to be formatted and then logged.
cause - The Throwable that originated this log call.
params - The list of parameter used to format the message.

trace

public final void trace(String message,
                        Object... params)
Creates a tracing level log message, the final message will depend on the underlying Formatter.

Specified by:
trace in interface Logger
Parameters:
message - The message to be formatted and then logged.
params - The list of parameter used to format the message.

trace

public final void trace(String message,
                        Throwable cause,
                        Object... params)
Creates a tracing level log message, the final message will depend on the underlying Formatter.

Specified by:
trace in interface Logger
Parameters:
message - The message to be formatted and then logged.
cause - The Throwable that originated this log call.
params - The list of parameter used to format the message.

warn

public final void warn(String message,
                       Object... params)
Creates a warning level log message, the final message will depend on the underlying Formatter.

Specified by:
warn in interface Logger
Parameters:
message - The message to be formatted and then logged.
params - The list of parameter used to format the message.

warn

public final void warn(String message,
                       Throwable cause,
                       Object... params)
Creates a warning level log message, the final message will depend on the underlying Formatter.

Specified by:
warn in interface Logger
Parameters:
message - The message to be formatted and then logged.
cause - The Throwable that originated this log call.
params - The list of parameter used to format the message.


Copyright © 2007-2010 The AceLogger Team. All Rights Reserved.