spring-boot: Custom logback configuration ignored in external Tomcat
When I provide custom logback.xml
configuration the file is not being used when the war
is deployed to external Tomcat (7.0.55). It is being used when running in embedded Tomcat though.
The content of logback.xml
:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!-- Spring boot base -->
<include resource="org/springframework/boot/logging/logback/base.xml" />
<logger name="com.springframework" level="ERROR" />
</configuration>
The application output:
2014-08-25 09:05:29.565 WARN 5348 --- [on(3)-127.0.0.1] o.s.b.l.LoggingApplicationListener : Logging environment value '-Djava.util.logging.config.file="C:\Documents and Settings\zykajan\.IntelliJIdea13\system\tomcat\Unnamed_cnc-parent_2\conf\logging.properties"' cannot be opened and will be ignored
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v1.1.5.RELEASE)
2014-08-25 09:05:29.643 INFO 5348 --- [on(3)-127.0.0.1] o.s.boot.SpringApplication : ...
About this issue
- Original URL
- State: closed
- Created 10 years ago
- Comments: 16 (9 by maintainers)
Commits related to this issue
- Continue with default location if CONFIG_LOGGING fails Tomcat in particular sets an environment variable in it's shell scripts that people commonly use to start the container. So if people deploy a w... — committed to spring-projects/spring-boot by deleted user 10 years ago
- Replace LOGGING_CONFIG BY CATALINA_LOGGING_CONFIG To avoid collision e.g. with spring framework like https://github.com/spring-projects/spring-boot/issues/1432 — committed to netbeansuser2019/tomcat by netbeansuser2019 4 years ago
- Replace LOGGING_CONFIG BY CATALINA_LOGGING_CONFIG To avoid collision e.g. with spring framework like spring-projects/spring-boot#1432 — committed to netbeansuser2019/tomcat by netbeansuser2019 4 years ago
Your suggestion makes sense to me - I was thrown by the fact that my configuration was picked up correctly (and an empty logfile created), but was then ignored from then on. Falling back to the original configuration would have the desired effect.
Part of the problem is the behind the scenes magic with regards to building the environment. Perhaps future properties could all be prefixed with ‘spring’ or similar to prevent these unintended namespace collisions?