Skip to content

logging.include-application-name has no effect when using log4j2 #38618

Closed as not planned
@duoduobingbing

Description

@duoduobingbing

As the title says, when creating a fresh Spring Boot 3.2.0 project the console logs generated by Logback look like this by default

2023-12-01T08:57:37.478+01:00  INFO 22208 --- [           main] com.example.demo.DemoApplicationTests    : No active profile set, falling back to 1 default profile: "default"
2023-12-01T08:57:38.181+01:00  INFO 22208 --- [           main] com.example.demo.DemoApplicationTests    : Started DemoApplicationTests in 0.832 seconds (process running for 1.308)

After switching from Logback to Log4j2 the console logs look like this

2023-12-01T09:02:33.314+01:00  INFO 14764 --- ${sys:LOGGED_APPLICATION_NAME}[           main] c.e.d.DemoApplicationTests               : No active profile set, falling back to 1 default profile: "default"
2023-12-01T09:02:33.938+01:00  INFO 14764 --- ${sys:LOGGED_APPLICATION_NAME}[           main] c.e.d.DemoApplicationTests               : Started DemoApplicationTests in 0.814 seconds (process running for 1.415)

Setting the new logging.include-application-name property to false does not make the ${sys:LOGGED_APPLICATION_NAME} disappear from the logged console output.

Here is a small reproducer: demo-reproducer.zip that can be run with mvn spring-boot:run

Metadata

Metadata

Labels

status: supersededAn issue that has been superseded by another

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions