Reputation: 1723
I configured spring boot to use log4j with these lines in pom.xml:
<!-- use log4j instead of logback (spring boots own logging) -->
<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-log4j</artifactId>
</dependency>
I stopped spring from logging at debug level to console by configuring my log4j.xml like that:
<root>
<priority value="ERROR" />
<appender-ref ref="consoleAppender" />
</root>
My question is what do I have to put into log4j.xml to get to see log messages from spring boot? This was not working for example (addition to log4j.xml):
<category name="org.springframework.web">
<level value="trace" />
</category>
What is the correct path or the correct method to get spring boot to log again using log4j?
Upvotes: 1
Views: 6447
Reputation: 39
It looks like you should have set the Error level to Info Level if you want to standard Spring output.
From the Log4J quick start site https://logging.apache.org/log4j/1.2/manual.html
This rule is at the heart of log4j. It assumes that levels are ordered. For the standard levels, we have DEBUG < INFO < WARN < ERROR < FATAL
So root should probably look like this
<root>
<level value="Info" />
<appender-ref ref="console" />
</root>
Upvotes: 2
Reputation: 58144
I think it's <logger>
not <category>
. Note that Spring Boot also saves you from having to remember that by making log levels configurable in application.properties.
Upvotes: 1