public class LoggingApplicationListener extends Object implements org.springframework.context.event.SmartApplicationListener
ApplicationListener that configures the LoggingSystem. If the
environment contains a logging.config property a then that will be used to
initialize the logging system, otherwise a default configuration is used.
By default, log output is only written to the console. If a log file is required the
logging.path and logging.file properties can be used.
Some system properties may be set as side effects, and these can be useful if the logging configuration supports placeholders (i.e. log4j or logback):
LOG_FILE is set to the value of path of the log file that should be written
(if any).PID is set to the value of the current process ID if it can be determined.LoggingSystem.get(ClassLoader)| Modifier and Type | Field and Description |
|---|---|
static String |
CONFIG_PROPERTY
The name of the Spring property that contains a reference to the logging
configuration to load.
|
static String |
FILE_PROPERTY
The name of the Spring property that contains the name of the logging configuration
file.
|
static String |
PATH_PROPERTY
The name of the Spring property that contains the path where the logging
configuration can be found.
|
static String |
PID_KEY
The name of the System property that contains the process ID.
|
| Constructor and Description |
|---|
LoggingApplicationListener() |
| Modifier and Type | Method and Description |
|---|---|
int |
getOrder() |
protected void |
initialize(org.springframework.core.env.ConfigurableEnvironment environment,
ClassLoader classLoader)
Initialize the logging system according to preferences expressed through the
Environment and the classpath. |
protected void |
initializeLogLevel(LoggingSystem system,
LogLevel level) |
void |
onApplicationEvent(org.springframework.context.ApplicationEvent event) |
protected void |
setLogLevels(LoggingSystem system,
org.springframework.core.env.Environment environment) |
void |
setOrder(int order) |
void |
setParseArgs(boolean parseArgs)
Sets if initialization arguments should be parsed for --debug and
--trace options.
|
void |
setSpringBootLogging(LogLevel springBootLogging)
Sets a custom logging level to be used for Spring Boot and related libraries.
|
boolean |
supportsEventType(Class<? extends org.springframework.context.ApplicationEvent> eventType) |
boolean |
supportsSourceType(Class<?> sourceType) |
public static final String CONFIG_PROPERTY
public static final String PATH_PROPERTY
public static final String FILE_PROPERTY
public static final String PID_KEY
public boolean supportsEventType(Class<? extends org.springframework.context.ApplicationEvent> eventType)
supportsEventType in interface org.springframework.context.event.SmartApplicationListenerpublic boolean supportsSourceType(Class<?> sourceType)
supportsSourceType in interface org.springframework.context.event.SmartApplicationListenerpublic void onApplicationEvent(org.springframework.context.ApplicationEvent event)
onApplicationEvent in interface org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>protected void initialize(org.springframework.core.env.ConfigurableEnvironment environment,
ClassLoader classLoader)
Environment and the classpath.protected void initializeLogLevel(LoggingSystem system, LogLevel level)
protected void setLogLevels(LoggingSystem system, org.springframework.core.env.Environment environment)
public void setOrder(int order)
public int getOrder()
getOrder in interface org.springframework.core.Orderedpublic void setSpringBootLogging(LogLevel springBootLogging)
springBootLogging - the logging levelpublic void setParseArgs(boolean parseArgs)
true.parseArgs - if arguments should be parsedCopyright © 2014 Pivotal Software, Inc.. All rights reserved.