|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.boot.context.initializer.LoggingApplicationContextInitializer
public class LoggingApplicationContextInitializer
An ApplicationContextInitializer that configures a logging framework depending
on what it finds on the classpath and in the Environment. If the environment
contains a property logging.config then that will be used to initialize
the logging system, otherwise a default location is used. The classpath is probed for
log4j and logback and if those are present they will be reconfigured, otherwise vanilla
java.util.logging will be used.
The default config locations are classpath:log4j.properties or
classpath:log4j.xml for log4j; classpath:logback.xml for
logback; and classpath:logging.properties for
java.util.logging. If the correct one of those files is not found then
some sensible defaults are adopted from files of the same name but in the package
containing LoggingApplicationContextInitializer.
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 logging.file if found in
the environmentLOG_PATH is set to the value of logging.path if found in
the environmentPID is set to the value of the current process ID if it can be
determined
| Field Summary |
|---|
| Fields inherited from interface org.springframework.core.Ordered |
|---|
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE |
| Constructor Summary | |
|---|---|
LoggingApplicationContextInitializer()
|
|
| Method Summary | |
|---|---|
int |
getOrder()
|
void |
initialize(org.springframework.context.ConfigurableApplicationContext applicationContext)
Initialize the logging system according to preferences expressed through the Environment and the classpath. |
void |
initialize(SpringApplication springApplication,
String[] args)
Initialize the application |
protected void |
initializeLogLevel(LoggingSystem system,
LogLevel level)
|
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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LoggingApplicationContextInitializer()
| Method Detail |
|---|
public void initialize(SpringApplication springApplication,
String[] args)
SpringApplicationInitializer
initialize in interface SpringApplicationInitializerspringApplication - the spring application.args - the run argumentspublic void initialize(org.springframework.context.ConfigurableApplicationContext applicationContext)
Environment and the classpath.
initialize in interface org.springframework.context.ApplicationContextInitializer<org.springframework.context.ConfigurableApplicationContext>
protected void initializeLogLevel(LoggingSystem system,
LogLevel level)
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 parsed
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||