Class ConsoleLogger
java.lang.Object
org.apache.avalon.framework.logger.ConsoleLogger
- All Implemented Interfaces:
org.apache.avalon.framework.logger.Logger
public final class ConsoleLogger
extends Object
implements org.apache.avalon.framework.logger.Logger
Logger sending everything to the standard output streams.
This is mainly for the cases when you have a utility that
does not have a logger to supply.
- Version:
- $Id: ConsoleLogger.java 30977 2004-07-30 03:57:54 -0500 (Fri, 30 Jul 2004) niclas $
- Author:
- Avalon Development Team
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Typecode for debugging messages.static final int
Typecode for disabled log levels.static final int
Typecode for error messages.static final int
Typecode for fatal error messages.static final int
Typecode for informational messages.static final int
Typecode for warning messages.private final int
-
Constructor Summary
ConstructorsConstructorDescriptionCreates a new ConsoleLogger with the priority set to DEBUG.ConsoleLogger
(int logLevel) Creates a new ConsoleLogger. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Logs a debugging message.void
Logs a debugging message and an exception.void
Logs an error message.void
Logs an error message and an exception.void
fatalError
(String message) Logs a fatal error message.void
fatalError
(String message, Throwable throwable) Logs a fatal error message and an exception.org.apache.avalon.framework.logger.Logger
getChildLogger
(String name) Just returns this logger (ConsoleLogger
is not hierarchical).void
Logs an informational message.void
Logs an informational message and an exception.boolean
Returnstrue
if debug-level logging is enabled, false otherwise.boolean
Returnstrue
if error-level logging is enabled, false otherwise.boolean
Returnstrue
if fatal-level logging is enabled, false otherwise.boolean
Returnstrue
if info-level logging is enabled, false otherwise.boolean
Returnstrue
if warn-level logging is enabled, false otherwise.void
Logs a warning message.void
Logs a warning message and an exception.
-
Field Details
-
LEVEL_DEBUG
public static final int LEVEL_DEBUGTypecode for debugging messages.- See Also:
-
LEVEL_INFO
public static final int LEVEL_INFOTypecode for informational messages.- See Also:
-
LEVEL_WARN
public static final int LEVEL_WARNTypecode for warning messages.- See Also:
-
LEVEL_ERROR
public static final int LEVEL_ERRORTypecode for error messages.- See Also:
-
LEVEL_FATAL
public static final int LEVEL_FATALTypecode for fatal error messages.- See Also:
-
LEVEL_DISABLED
public static final int LEVEL_DISABLEDTypecode for disabled log levels.- See Also:
-
m_logLevel
private final int m_logLevel
-
-
Constructor Details
-
ConsoleLogger
public ConsoleLogger()Creates a new ConsoleLogger with the priority set to DEBUG. -
ConsoleLogger
public ConsoleLogger(int logLevel) Creates a new ConsoleLogger.- Parameters:
logLevel
- log level typecode
-
-
Method Details
-
debug
Logs a debugging message.- Specified by:
debug
in interfaceorg.apache.avalon.framework.logger.Logger
- Parameters:
message
- aString
value
-
debug
Logs a debugging message and an exception.- Specified by:
debug
in interfaceorg.apache.avalon.framework.logger.Logger
- Parameters:
message
- aString
valuethrowable
- aThrowable
value
-
isDebugEnabled
public boolean isDebugEnabled()Returnstrue
if debug-level logging is enabled, false otherwise.- Specified by:
isDebugEnabled
in interfaceorg.apache.avalon.framework.logger.Logger
- Returns:
true
if debug-level logging
-
info
Logs an informational message.- Specified by:
info
in interfaceorg.apache.avalon.framework.logger.Logger
- Parameters:
message
- aString
value
-
info
Logs an informational message and an exception.- Specified by:
info
in interfaceorg.apache.avalon.framework.logger.Logger
- Parameters:
message
- aString
valuethrowable
- aThrowable
value
-
isInfoEnabled
public boolean isInfoEnabled()Returnstrue
if info-level logging is enabled, false otherwise.- Specified by:
isInfoEnabled
in interfaceorg.apache.avalon.framework.logger.Logger
- Returns:
true
if info-level logging is enabled
-
warn
Logs a warning message.- Specified by:
warn
in interfaceorg.apache.avalon.framework.logger.Logger
- Parameters:
message
- aString
value
-
warn
Logs a warning message and an exception.- Specified by:
warn
in interfaceorg.apache.avalon.framework.logger.Logger
- Parameters:
message
- aString
valuethrowable
- aThrowable
value
-
isWarnEnabled
public boolean isWarnEnabled()Returnstrue
if warn-level logging is enabled, false otherwise.- Specified by:
isWarnEnabled
in interfaceorg.apache.avalon.framework.logger.Logger
- Returns:
true
if warn-level logging is enabled
-
error
Logs an error message.- Specified by:
error
in interfaceorg.apache.avalon.framework.logger.Logger
- Parameters:
message
- aString
value
-
error
Logs an error message and an exception.- Specified by:
error
in interfaceorg.apache.avalon.framework.logger.Logger
- Parameters:
message
- aString
valuethrowable
- aThrowable
value
-
isErrorEnabled
public boolean isErrorEnabled()Returnstrue
if error-level logging is enabled, false otherwise.- Specified by:
isErrorEnabled
in interfaceorg.apache.avalon.framework.logger.Logger
- Returns:
true
if error-level logging is enabled
-
fatalError
Logs a fatal error message.- Specified by:
fatalError
in interfaceorg.apache.avalon.framework.logger.Logger
- Parameters:
message
- aString
value
-
fatalError
Logs a fatal error message and an exception.- Specified by:
fatalError
in interfaceorg.apache.avalon.framework.logger.Logger
- Parameters:
message
- aString
valuethrowable
- aThrowable
value
-
isFatalErrorEnabled
public boolean isFatalErrorEnabled()Returnstrue
if fatal-level logging is enabled, false otherwise.- Specified by:
isFatalErrorEnabled
in interfaceorg.apache.avalon.framework.logger.Logger
- Returns:
true
if fatal-level logging is enabled
-
getChildLogger
Just returns this logger (ConsoleLogger
is not hierarchical).- Specified by:
getChildLogger
in interfaceorg.apache.avalon.framework.logger.Logger
- Parameters:
name
- ignored- Returns:
- this logger
-