public class PreBootstrapLogger
extends org.slf4j.helpers.MarkerIgnoringBase
implements org.slf4j.spi.LocationAwareLogger, org.slf4j.Logger
SLF4JDelegatingLog to temporarily store
logging events before the actual
logging system is loaded.
At instance level, we only implement a LocationAwareLogger. The rest
of the Logger interface is not implemented. This is a very limited
implementation that is tailored for the only use of
SLF4JDelegatingLog.
We only implement LocationAwareLogger because before the actual
logging system is bootstrapped, we cannot tell if actual loggers will be
location aware loggers or not, so we assume they will be. The same goes for
loggers activation. We make no assumption on activated log levels, so this
implementation acts as if all log levels where enabled.
At class level, all created instances are registered in a collection, so that
they can be swapped in their respective SLF4JDelegatingLog by an
actual SLF4J logger. When the Logback bootstrapping has
started, a call to swapLoggers() runs this swapping process.
This class does not implement thread safety. It's the responsibility of client code to properly synchronize calls to these three methods, using a single lock:
PreBootstrapLogger(SLF4JDelegatingLog, String) (constructor)log(Marker, String, int, String, Object[], Throwable) (instance
method)
swapLoggers() (class method)SLF4JDelegatingLog do (globally)
synchronize access to the three methods above.
Diagnostics can be activated by lowering the
SLF4JDelegatingLog.diagnostics level.
PreBootstrapLoggingEvent,
SLF4JDelegatingLog,
Serialized Form| Modifier and Type | Field and Description |
|---|---|
protected String |
name |
| Constructor and Description |
|---|
PreBootstrapLogger(SLF4JDelegatingLog facade,
String name)
Creates a new pre-bootstrap logger.
|
| Modifier and Type | Method and Description |
|---|---|
void |
debug(String msg) |
void |
debug(String format,
Object... arguments) |
void |
debug(String format,
Object arg) |
void |
debug(String format,
Object arg1,
Object arg2) |
void |
debug(String msg,
Throwable t) |
void |
error(String msg) |
void |
error(String format,
Object... arguments) |
void |
error(String format,
Object arg) |
void |
error(String format,
Object arg1,
Object arg2) |
void |
error(String msg,
Throwable t) |
void |
info(String msg) |
void |
info(String format,
Object... arguments) |
void |
info(String format,
Object arg) |
void |
info(String format,
Object arg1,
Object arg2) |
void |
info(String msg,
Throwable t) |
boolean |
isDebugEnabled() |
boolean |
isErrorEnabled() |
boolean |
isInfoEnabled() |
boolean |
isTraceEnabled() |
boolean |
isWarnEnabled() |
void |
log(org.slf4j.Marker marker,
String fqcn,
int level,
String msg,
Object[] args,
Throwable t)
This implementations just stores a pre-bootstrap logging event.
|
protected Object |
readResolve() |
void |
trace(String msg) |
void |
trace(String format,
Object... args) |
void |
trace(String format,
Object arg) |
void |
trace(String format,
Object arg1,
Object arg2) |
void |
trace(String msg,
Throwable t) |
void |
warn(String msg) |
void |
warn(String format,
Object... arguments) |
void |
warn(String format,
Object arg) |
void |
warn(String format,
Object arg1,
Object arg2) |
void |
warn(String msg,
Throwable t) |
debug, debug, debug, debug, debug, error, error, error, error, error, info, info, info, info, info, isDebugEnabled, isErrorEnabled, isInfoEnabled, isTraceEnabled, isWarnEnabled, toString, trace, trace, trace, trace, trace, warn, warn, warn, warn, warnclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitdebug, debug, debug, debug, debug, error, error, error, error, error, getName, info, info, info, info, info, isDebugEnabled, isErrorEnabled, isInfoEnabled, isTraceEnabled, isWarnEnabled, trace, trace, trace, trace, trace, warn, warn, warn, warn, warnprotected String name
public PreBootstrapLogger(SLF4JDelegatingLog facade, String name)
facade - the facade for the underlying logger to createname - the logger namepublic void log(org.slf4j.Marker marker,
String fqcn,
int level,
String msg,
Object[] args,
Throwable t)
This implementations just stores a pre-bootstrap logging event.
log in interface org.slf4j.spi.LocationAwareLoggerpublic boolean isTraceEnabled()
isTraceEnabled in interface org.slf4j.Loggerpublic void trace(String msg)
trace in interface org.slf4j.Loggerpublic void trace(String format, Object arg)
trace in interface org.slf4j.Loggerpublic void trace(String format, Object arg1, Object arg2)
trace in interface org.slf4j.Loggerpublic void trace(String format, Object... args)
trace in interface org.slf4j.Loggerpublic boolean isDebugEnabled()
isDebugEnabled in interface org.slf4j.Loggerpublic void debug(String msg)
debug in interface org.slf4j.Loggerpublic void debug(String format, Object arg)
debug in interface org.slf4j.Loggerpublic void debug(String format, Object arg1, Object arg2)
debug in interface org.slf4j.Loggerpublic void debug(String format, Object... arguments)
debug in interface org.slf4j.Loggerpublic boolean isInfoEnabled()
isInfoEnabled in interface org.slf4j.Loggerpublic void info(String msg)
info in interface org.slf4j.Loggerpublic void info(String format, Object arg1, Object arg2)
info in interface org.slf4j.Loggerpublic void info(String format, Object... arguments)
info in interface org.slf4j.Loggerpublic boolean isWarnEnabled()
isWarnEnabled in interface org.slf4j.Loggerpublic void warn(String msg)
warn in interface org.slf4j.Loggerpublic void warn(String format, Object... arguments)
warn in interface org.slf4j.Loggerpublic void warn(String format, Object arg1, Object arg2)
warn in interface org.slf4j.Loggerpublic boolean isErrorEnabled()
isErrorEnabled in interface org.slf4j.Loggerpublic void error(String msg)
error in interface org.slf4j.Loggerpublic void error(String format, Object arg)
error in interface org.slf4j.Loggerpublic void error(String format, Object arg1, Object arg2)
error in interface org.slf4j.Loggerpublic void error(String format, Object... arguments)
error in interface org.slf4j.Loggerprotected Object readResolve() throws ObjectStreamException
ObjectStreamExceptionCopyright © 2015–2017. All rights reserved.