- Add in
application.properties:logging.config=classpath:log4j.properties - Create file
log4j.propertiesin dirresources
- Exclude standard logger:
<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>
- Add log4j2 starter
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
You can choose different levels of logging.
List of levels from general to specific:
- TRACE
- DEBUG
- INFO
- WARN
- ERROR
- FATAL
- OFF for disable
For example if you select level "WARN", then show only this levels:
- WARN
- ERROR
- FATAL