public class LogService extends Object
Logger
instances through a LoggerFactory
.
This service supports "nested diagnostic contexts" and progress tracking through pushContext(String, Object)
.
It is up to the underlying LoggerFactory
implementations to support those features as they can.
The default LoggerFactory used in Slf4JLoggerFactory
which allows the log to be bound to most any underlying logging system
via SLF4j.Modifier and Type | Method and Description |
---|---|
void |
close()
Close the current log factory.
|
static Logger |
getLog(Class clazz)
Returns a Logger for the given class based on the configured
setLoggerFactory(LoggerFactory) . |
static LoggerContext |
pushContext(String key,
Object object)
Pushes a new nested diagnostic context onto the stack.
|
static void |
setLoggerFactory(LoggerFactory service)
Set the LoggerFactory used by this singleton.
|
public static void setLoggerFactory(LoggerFactory service)
public static Logger getLog(Class clazz)
setLoggerFactory(LoggerFactory)
.
There is no string version of this class to force a class-based log pattern.public static LoggerContext pushContext(String key, Object object)
LoggerContext
most be LoggerContext.close()
'ed correctly.
Ususally a "try with resource" pattern is best.public void close()
Copyright © 2019 Liquibase.org. All rights reserved.