Interface Logger
- All Known Implementing Classes:
AbstractLogger, DefaultLogger, Log4JLogger, SLF4JLogger, SunLogger
public interface Logger
Abstract mechanism for dealing with logs from various objects.
Implementations are expected to have a constructor that takes a single String
representing the name of the logging item, or an empty constructor.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoidLog a message at debug level.voidLog a message at debug level.voidLog a formatted message at debug level.voidLog a message at error level.voidLog a message at error level.voidLog a formatted message at debug level.voidLog a message at fatal level.voidLog a message at fatal level.voidLog a formatted message at debug level.getName()Get the name of this logger.voidLog a message at info level.voidLog a message at info level.voidLog a formatted message at info level.booleanChecks whether DEBUG logging is enabled.booleanChecks whether INFO logging is enabled.booleanChecks whether TRACE logging is enabled.voidLog a message at the specified level.voidLog a message at the specified level.voidLog a message at trace level.voidLog a message at trace level.voidLog a formatted message at trace level.voidLog a message at warning level.voidLog a message at warning level.voidLog a formatted message at debug level.
-
Method Details
-
getName
String getName()Get the name of this logger. -
isDebugEnabled
boolean isDebugEnabled()Checks whether DEBUG logging is enabled. This may return true, even when the logger is configured to not put the resulting output anywhere. You can use this method to avoid potential expensive (debugging) code when there is no need for it since it will be dropped anyway:if (log.isDebugEnabled()) { ... expensive code here ... log.debug(result); }- Returns:
- true if debug messages would be displayed.
-
isInfoEnabled
boolean isInfoEnabled()Checks whether INFO logging is enabled. This may return true, even when the logger is configured to not put the resulting output anywhere. You can use this method to avoid potential expensive (debugging) code when there is no need for it since it will be dropped anyway:if (log.isInfoEnabled()) { ... expensive code here ... log.info(result); }- Returns:
- true if info messages would be displayed.
-
isTraceEnabled
boolean isTraceEnabled()Checks whether TRACE logging is enabled. This may return true, even when the logger is configured to not put the resulting output anywhere. You can use this method to avoid potential expensive (debugging) code when there is no need for it since it will be dropped anyway:if (log.isTraceEnabled()) { ... expensive code here ... log.trace(result); }- Returns:
- true if trace messages would be displayed.
-
log
-
log
-
trace
-
trace
-
trace
-
debug
-
debug
-
debug
-
info
-
info
-
info
-
warn
-
warn
-
warn
-
error
-
error
-
error
-
fatal
-
fatal
-
fatal
-