public interface LoggerProvider
Logger
instances for each Source
object.
It is not usually necessary for users to create implementations of this interface, as
several predefined instances are defined which provide the most commonly required Logger
implementations.
By default, a LoggerProvider
is chosen automatically according to the algorithm described in the static Config.LoggerProvider
property.
This automatic choice can be overridden by setting the Config.LoggerProvider
property manually with an instance of this interface,
but this is also usually not necessary.
Modifier and Type | Field and Description |
---|---|
static LoggerProvider |
DISABLED
A
LoggerProvider implementation that disables all log messages. |
static LoggerProvider |
JAVA
A
LoggerProvider implementation that wraps the standard java.util.logging system included in the Java SDK version 1.4 and above. |
static LoggerProvider |
JCL
A
LoggerProvider implementation that wraps the Jakarta Commons Logging (JCL) framework. |
static LoggerProvider |
LOG4J
A
LoggerProvider implementation that wraps the Apache Log4J framework. |
static LoggerProvider |
SLF4J
A
LoggerProvider implementation that wraps the SLF4J framework. |
static LoggerProvider |
STDERR
A
LoggerProvider implementation that sends all log messages to the standard error output stream (System.err ). |
Modifier and Type | Method and Description |
---|---|
Logger |
getLogger(java.lang.String name)
Creates a new
Logger instance with the specified name. |
Logger |
getSourceLogger()
|
static final LoggerProvider DISABLED
LoggerProvider
implementation that disables all log messages.static final LoggerProvider STDERR
LoggerProvider
implementation that sends all log messages to the standard error output stream (System.err
).
The implementation uses the following code to create each logger:
new
WriterLogger
(new OutputStreamWriter(System.err),name)
static final LoggerProvider JAVA
LoggerProvider
implementation that wraps the standard java.util.logging
system included in the Java SDK version 1.4 and above.
This is the default used if no other logging framework is detected. See the description of the static Config.LoggerProvider
property for more details.
The following mapping of logging levels is used:
Logger level | java.util.logging.Level
|
---|---|
ERROR | SEVERE
|
WARN | WARNING
|
INFO | INFO
|
DEBUG | FINE
|
static final LoggerProvider JCL
LoggerProvider
implementation that wraps the Jakarta Commons Logging (JCL) framework.
See the description of the static Config.LoggerProvider
property for details on when this implementation is used as the default.
The following mapping of logging levels is used:
Logger level | org.apache.commons.logging level
|
---|---|
ERROR | error
|
WARN | warn
|
INFO | info
|
DEBUG | debug
|
static final LoggerProvider LOG4J
LoggerProvider
implementation that wraps the Apache Log4J framework.
See the description of the static Config.LoggerProvider
property for details on when this implementation is used as the default.
The following mapping of logging levels is used:
Logger level | org.apache.log4j.Level
|
---|---|
ERROR | ERROR
|
WARN | WARN
|
INFO | INFO
|
DEBUG | DEBUG
|
static final LoggerProvider SLF4J
LoggerProvider
implementation that wraps the SLF4J framework.
See the description of the static Config.LoggerProvider
property for details on when this implementation is used as the default.
The following mapping of logging levels is used:
Logger level | org.slf4j.Logger level
|
---|---|
ERROR | error
|
WARN | warn
|
INFO | info
|
DEBUG | debug
|
Logger getLogger(java.lang.String name)
Logger
instance with the specified name.
The name
argument is used by the underlying logging implementation, and is normally a dot-separated name based on
the package name or class name of the subsystem.
The getSourceLogger()
method is used internally instead of this method to avoid creating a new logger instance for every Source
instance,
which would result in a bottleneck in highly concurrent applications.
name
- the name of the logger, the use of which is determined by the underlying logging implementation, may be null
.Logger
instance with the specified name.Logger getSourceLogger()