public class DeferredInitializationLoggerAdapter extends java.lang.Object implements Logger
PrintStreamLogger instance.
However, with every method it checks the internal logger factory registry for the actually desired logger factory type. If it finds it, it creates a new logger with that factory and replaced the underlying logger to which it delegates all method calls.
This approach allows static logger initialization even before the desired logger adapter has been registered. As soon as the desired logger adapter is available, logging will be re-routed to this adapter.
ANONYMOUS_LOGGER_NAME, LL_DEBUG, LL_ERROR, LL_INFO, LL_NONE, LL_WARNING| Constructor and Description |
|---|
DeferredInitializationLoggerAdapter(java.lang.String desiredLoggerType) |
DeferredInitializationLoggerAdapter(java.lang.String desiredLoggerType,
java.lang.Class<?> clazz) |
DeferredInitializationLoggerAdapter(java.lang.String desiredLoggerType,
java.lang.String loggerName) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
checkTargetLogger()
Checks if the current target logger is of the desired type.
|
protected java.lang.String |
getDesiredLoggerType() |
protected java.lang.String |
getLoggerName() |
java.lang.String |
getName()
Returns the name of this logger.
|
protected java.lang.String |
getOwnLogLevel() |
protected Logger |
getTargetLogger() |
void |
initialize(java.util.Properties properties)
Initialize the logger from the given properties settings.
|
protected void |
initTargetLogger() |
protected boolean |
isDesiredLoggerType(java.lang.String name) |
protected boolean |
isDesiredLoggerTypeStillNotAvailable() |
boolean |
isLoggingDebugs()
Returns true, if debug messages will be written to the output device(s).
|
boolean |
isLoggingErrors()
Returns true, if errors will be written to the output device(s).
|
boolean |
isLoggingInfos()
Returns true, if info messages will be written to the output device(s).
|
boolean |
isLoggingWarnings()
Returns true, if warnings will be written to the output device(s).
|
void |
logDebug(java.lang.String message,
java.lang.Object... params)
If the logging level is DEBUG the given message will be written to
the log output device(s).
|
void |
logError(java.lang.String message,
java.lang.Object... params)
If the logging level is DEBUG, INFO, WARNING or ERROR the given message
will be written to the log output device(s).
|
void |
logError(java.lang.String message,
java.lang.Throwable exception)
If the logging level is DEBUG, INFO, WARNING or ERROR the given message
and the exception will be written to the log output device(s).
|
void |
logException(java.lang.Throwable ex)
Writes the given exception to the log output device(s).
|
void |
logInfo(java.lang.String message,
java.lang.Object... params)
If the logging level is INFO or DEBUG the given message will be
written to the log output device(s).
|
void |
logWarning(java.lang.String message,
java.lang.Object... params)
If the logging level is DEBUG, INFO or WARNING the given message will
be written to the log output device(s).
|
void |
logWarning(java.lang.String message,
java.lang.Throwable exception)
If the logging level is DEBUG, INFO or WARNING the given message
and the exception will be written to the log output device(s).
|
boolean |
setLogLevel(java.lang.String level)
Changes the log level to the specified level.
|
protected void |
setOwnLogLevel(java.lang.String ownLogLevel) |
protected void |
setTargetLogger(Logger targetLogger) |
public DeferredInitializationLoggerAdapter(java.lang.String desiredLoggerType)
public DeferredInitializationLoggerAdapter(java.lang.String desiredLoggerType,
java.lang.Class<?> clazz)
public DeferredInitializationLoggerAdapter(java.lang.String desiredLoggerType,
java.lang.String loggerName)
public java.lang.String getName()
Loggerpublic void initialize(java.util.Properties properties)
Loggerinitialize in interface Loggerpublic boolean isLoggingDebugs()
LoggerisLoggingDebugs in interface Loggerpublic boolean isLoggingInfos()
LoggerisLoggingInfos in interface Loggerpublic boolean isLoggingWarnings()
LoggerisLoggingWarnings in interface Loggerpublic boolean isLoggingErrors()
LoggerisLoggingErrors in interface Loggerpublic void logDebug(java.lang.String message,
java.lang.Object... params)
Loggerpublic void logInfo(java.lang.String message,
java.lang.Object... params)
Loggerpublic void logWarning(java.lang.String message,
java.lang.Object... params)
LoggerlogWarning in interface Loggermessage - The message to log. It may contain placeholders like {0}, {1} etc.params - Optional parameters to be used for replacing placeholders in the message text.public void logWarning(java.lang.String message,
java.lang.Throwable exception)
LoggerlogWarning in interface Loggerpublic void logError(java.lang.String message,
java.lang.Object... params)
Loggerpublic void logError(java.lang.String message,
java.lang.Throwable exception)
Loggerpublic void logException(java.lang.Throwable ex)
LoggerlogException in interface Loggerpublic boolean setLogLevel(java.lang.String level)
LoggersetLogLevel in interface Loggerlevel - One of the LL_ constants defined in this interface (e.g. Logger.LL_ERROR).protected java.lang.String getLoggerName()
protected void checkTargetLogger()
protected void initTargetLogger()
protected boolean isDesiredLoggerTypeStillNotAvailable()
protected boolean isDesiredLoggerType(java.lang.String name)
protected Logger getTargetLogger()
protected void setTargetLogger(Logger targetLogger)
protected java.lang.String getDesiredLoggerType()
protected java.lang.String getOwnLogLevel()
protected void setOwnLogLevel(java.lang.String ownLogLevel)