sarath kumar
sarath kumar

Reputation: 41

How to disable jndi debug logs in spring boot

How to disable the below debug logs in spring boot? These logs appear whenever health check request is made to the application.

I've tried setting the logger level to info for these packages "org.springframework.jndi" and "javax.naming" in our log configuration file, but the above lines still appear whenever health check request is made.

[DEBUG] jndi - InitialContextFactory.getInitialContext()
[DEBUG] jndi - Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@756a5bed
[DEBUG] jndi - Looking up name="comp/env/endpoints.enabled"
[DEBUG] jndi - Trying thread context classloader
[DEBUG] jndi - Looking up name="env/endpoints.enabled"
[DEBUG] jndi - InitialContextFactory.getInitialContext()
[DEBUG] jndi - Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@6a85ff9f
[DEBUG] jndi - Looking up name="endpoints.enabled"
[DEBUG] jndi - InitialContextFactory.getInitialContext()
[DEBUG] jndi - Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@293101e3
[DEBUG] jndi - Looking up name="comp/env/endpoints.health.sensitive"
[DEBUG] jndi - Trying thread context classloader
[DEBUG] jndi - Looking up name="env/endpoints.health.sensitive"
[DEBUG] jndi - InitialContextFactory.getInitialContext()
[DEBUG] jndi - Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@235a3b05
[DEBUG] jndi - Looking up name="endpoints.health.sensitive"
[DEBUG] jndi - InitialContextFactory.getInitialContext()
[DEBUG] jndi - Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@439cc794
[DEBUG] jndi - Looking up name="comp/env/endpoints.health.sensitive"
[DEBUG] jndi - Trying thread context classloader
[DEBUG] jndi - Looking up name="env/endpoints.health.sensitive"
[DEBUG] jndi - InitialContextFactory.getInitialContext()
[DEBUG] jndi - Created initial context delegate for local namespace:org.eclipse.jetty.jndi.local.localContextRoot@221fa466
[DEBUG] jndi - Looking up name="endpoints.health.sensitive"

Upvotes: 4

Views: 3042

Answers (4)

Wim van der Veen
Wim van der Veen

Reputation: 1

@balbusm was on the right track for me, but I had to expand it a little:

        <Logger name="org.springframework.jndi" level="WARN" additivity="false"/>

(this is the SpringBoot version of course)

Upvotes: 0

Thomas Oellrich
Thomas Oellrich

Reputation: 1297

Excluding jetty-jndi from the classpath did the trick for me

<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-jetty</artifactId>
  <!-- see https://github.com/spring-projects/spring-boot/issues/4710 -->
  <exclusions>
    <exclusion>
      <groupId>org.eclipse.jetty</groupId>
      <artifactId>jetty-jndi</artifactId>
    </exclusion>
  </exclusions>
</dependency>

Upvotes: 2

balbusm
balbusm

Reputation: 1734

From Jetty source code looks that logging level for jndi needs to be modified:

<logger name="jndi" level="WARN"/>

Upvotes: 0

Diogo
Diogo

Reputation: 553

Add to logback.xml the code

<logger name="org.eclipse.jetty" level="WARN"/>

Upvotes: 0

Related Questions