public class EnvironmentLoggingApplicationListener
extends java.lang.Object
implements org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>
ApplicationListener
used to log the state of the Spring Environment
on the ContextRefreshedEvent
.Logger
,
LoggerFactory
,
ApplicationListener
,
ContextRefreshedEvent
,
Environment
,
PropertySource
Modifier and Type | Class and Description |
---|---|
protected class |
EnvironmentLoggingApplicationListener.AbstractPropertySourceLoggingFunction |
protected class |
EnvironmentLoggingApplicationListener.EnumerablePropertySourceLoggingFunction |
protected class |
EnvironmentLoggingApplicationListener.MapPropertySourceLoggingFunction |
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
SYSTEM_ERR_ENABLED_PROPERTY |
Constructor and Description |
---|
EnvironmentLoggingApplicationListener() |
Modifier and Type | Method and Description |
---|---|
protected java.util.function.Function<org.springframework.core.env.PropertySource<?>,org.springframework.core.env.PropertySource<?>> |
getCompositePropertySourceLoggingFunction()
Returns a Composite
Function capable of introspecting and logging properties
from specifically typed PropertySources . |
protected org.slf4j.Logger |
getLogger()
Gets a reference to the configured SLF4J
Logger . |
protected void |
log(java.lang.String message,
java.lang.Object... args)
Logs the given
message formatted with the given array of arguments
to the configured Spring Boot application log. |
void |
onApplicationEvent(org.springframework.context.event.ContextRefreshedEvent contextRefreshedEvent) |
protected static final java.lang.String SYSTEM_ERR_ENABLED_PROPERTY
public EnvironmentLoggingApplicationListener()
public void onApplicationEvent(@NonNull org.springframework.context.event.ContextRefreshedEvent contextRefreshedEvent)
onApplicationEvent
in interface org.springframework.context.ApplicationListener<org.springframework.context.event.ContextRefreshedEvent>
protected java.util.function.Function<org.springframework.core.env.PropertySource<?>,org.springframework.core.env.PropertySource<?>> getCompositePropertySourceLoggingFunction()
Function
capable of introspecting and logging properties
from specifically typed PropertySources
.Function
capable of introspecting and logging the properties
from specifically typed PropertySources
.PropertySource
,
Function
@NonNull protected org.slf4j.Logger getLogger()
Logger
.Logger
.Logger
protected void log(java.lang.String message, java.lang.Object... args)
message
formatted with the given array of arguments
to the configured Spring Boot application log.
The given message
will only be logged if it contains text, otherwise this method does nothing
and silently returns.message
- String
containing the message to log.args
- optional array of arguments
to apply when formatting the message
.logToSlf4jLogger(String, Object...)
,
logToSystemErr(String, Object...)