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
Comment From: mhalbritter
Thanks for the report and the reproducer. This looks like a bug.
Comment From: mhalbritter
When setting the spring.application.name=my-app, the log output looks sane, as [my-app] is included instead of that ugly placeholder.
Comment From: itsAkshayDubey
Hi @mhalbritter ,
I would appreciate it if you could assign this bug to me, allowing me to work on resolving it.
Thanks, Akshay
Comment From: itsAkshayDubey
When setting the
spring.application.name=my-app, the log output looks sane, as[my-app]is included instead of that ugly placeholder.
When logging.include-application-name is set to false, the ${sys:LOGGED_APPLICATION_NAME} placeholder appears in the logs, irrespective of whether the spring.application.name property is present or not. On the other hand, when logging.include-application-name is set to its default value of true, the ${sys:LOGGED_APPLICATION_NAME} placeholder is only present in the logs when the spring.application.name property is not set.
Comment From: ilies-bel
Hello,
I'd like to correct this problem, my PR is ready, please tell me if I have the right to propose it.
Thanks
Comment From: crspereira
I´m receved this same menssage. Do we already have a solution?
Comment From: philwebb
@crspereira This issue is open and targeted to 3.2.x. That means we want to fix it in a 3.2 release, but we haven't yet got to it. Once fixed, the issue will be closed and the milestone will be set to the version that we fixed it in.
Comment From: philwebb
@ilies-bel A pull request would be most welcome, please submit it at your earliest convenience.
Comment From: ilies-bel
Done, I am new to this project, tell me if I forgot anything
Comment From: philwebb
Closing in favor of PR #38847. Thanks @ilies-bel!