'No logging happens for jdbc in springboot

In my application.properties I have

log4j.category.org.springframework.jdbc.core = TRACE
log4j.logger.org.springframework.jdbc=DEBUG

and the below dependencies in my pom.xml:

 <dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter</artifactId>
  <exclusions>
    <exclusion>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-logging</artifactId>
    </exclusion>
  </exclusions>
</dependency>
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>

But no logging happens for jdbc statements, although my main application's INFO level logs are appearing. What could cause this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source