David
David

Reputation: 187

Default value for logging level in spring boot will not be taken when using environment variables

If I want to set the logging level in the yaml configuration via environment variables and the environment variable is not set, the default value will not be taken.

logging.level.: ${LOG_LEVEL:INFO}
logging.level.org.hibernate: ${LOG_LEVEL_HIBERNATE:INFO}

Output:

o.s.b.l.LoggingApplicationListener: Cannot set level: ${LOG_LEVEL:INFO} for ''
o.s.b.l.LoggingApplicationListener: Cannot set level: ${LOG_LEVEL_HIBERNATE:INFO} for 'org.hibernate'

This is only when setting the logging level, because in LoggingApplicationListener#setLogLevels a PropertyPlaceholderResolver wasn't used. All other properties can be set via env vars and it's belonging default values...

Does anyone solved this, perhaps by overriding the LoggingApplicationListener?

Upvotes: 0

Views: 1550

Answers (1)

Dave Syer
Dave Syer

Reputation: 58094

That wasn't supported in Spring Boot (it is now: https://github.com/spring-projects/spring-boot/issues/1680).

Upvotes: 1

Related Questions