Hello,
I am using Spring Boot 1.5.6(sorry, had mentioned 1.5.7 by mistake earlier) and am getting the below Tomcat Log messages when deploying through a WAR.
10:44:56.487 [main] DEBUG jndi - Looking up name="env/LOGGING_PATTERNLEVEL"
10:44:56.487 [main] DEBUG org.springframework.jndi.JndiLocatorDelegate - Converted JNDI name [java:comp/env/LOGGING_PATTERNLEVEL] not found - trying original name [LOGGING_PATTERNLEVEL]. javax.naming.NameNotFoundException; remaining name 'env/LOGGING_PATTERNLEVEL'
This is the exact issue as faced and discussed on this question
As per the resolution mentioned there we need to disable the JNDIPropertySource
spring.jndi.ignore=true
But there is also conflicting advice in the other answer about renaming the logback file.
What is the correct way to resolve this issue ? It would be great if the springboot team could put up an official response.
Thanks.
Comment From: philwebb
I don't think we know a single "correct" way to solve this. Are you have to share a project that replicates the issue? Perhaps there's something additional that we can add to allow the JNDI source to skip logging.
Comment From: spring-projects-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Comment From: re-pvsr
Hello, I am attaching a sample app with almost no code, except a line which prints Hello and the complete pom.xml and application.properties file is intact. I have tested this and it works fine (i.e. prints hello) and deployed it in tomcat 8 server and checked that it does indeed created the issue I highlighted above.
Hope you can help. HelloApp-ForSpringBootTeam.tar.gz
Comment From: snicoll
@re-pvsr renaming the file will have no effect for you as you're using the springProfile feature, it has to be named that way. If you don't use JNDI, I'd recommend to disable it as the SO thread indicates.
@philwebb looks like a lifecycle issue to me, logback is not configured before the environment is fully prepared and that lead to unnecessary debug statements. I don't think JNDI is really the issue here, anything that'd log things in debug in that phase would be affected.
Comment From: GJKrupa
We're having trouble with a similar issue (using Spring Boot 1.5.9) but in a slightly different condition (and with no JNDI involved): During startup of SpringBootTest tests, this is causing all of the environment variables to be dumped out to System.out by org.springframework.core.env.StandardEnvironment including credentials injected via the CI system (which isn't Jenkins so doesn't automatically suppress credentials in the logs).
As a workaround I ended up renaming to logback.xml and using the very hacky (and I'm sure very brittle) condition: <if condition='isDefined("spring.beaninfo.ignore")'> to prevent Logback from balking when it initialises without
Comment From: philwebb
@GJKrupa Do you have a sample application you can share?
Comment From: GJKrupa
@philwebb This should demonstrate the issue. I've upped Spring Boot to 2.0.2 but still see the same problem when using SpringRunner for unit/integration tests. The two tests check for system properties and environment variables in the log output by hijacking System.out during class initialisation.
https://github.com/GJKrupa/spring_test_logs_environment
It's not an issue for Jenkins users since that conceals credentials injected by environment variables but we're using Drone CI which had that feature removed (and it won't be re-added until the next release - https://github.com/drone/drone/issues/2107).
Comment From: wilkinsona
This was fixed in 3.1 by https://github.com/spring-projects/spring-boot/issues/35238.