Hi

I tried to use structured logging available in Spring Boot 3.4-M2 based on this article https://spring.io/blog/2024/08/23/structured-logging-in-spring-boot-3-4

As it's stated I only have to add new property:

logging.structured.format.console=ecs

But log output is still in old (not JSON) format:

11:17:01.356 [main] INFO org.sample.it.Application -- Process aa started
11:17:01.363 [main] INFO org.sample.it.Application -- Process DB started
11:17:01.367 [main] INFO org.sample.it.Application -id="1"- Process aa started

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/

 :: Spring Boot ::             (v3.4.0-M2)

2024-09-09T11:17:03.344+03:00  INFO 11720 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data JPA repositories in DEFAULT mode.
2024-09-09T11:17:03.402+03:00  INFO 11720 --- [           main] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 52 ms. Found 1 JPA repository interface.
2024-09-09T11:17:04.575+03:00  INFO 11720 --- [           main] o.s.b.w.embedded.tomcat.TomcatWebServer  : Tomcat initialized with port 9002 (http)

Comment From: wilkinsona

It works for me with a freshly-created project from https://start.spring.io using 3.4.0-M2. With logging.structured.format.console=ecs in application.properties, the app's output looks like this when started:

{"@timestamp":"2024-09-09T08:57:59.098901Z","log.level":"INFO","process.pid":18901,"process.thread.name":"main","service.name":"gh-42183","log.logger":"com.example.gh_42183.Gh42183Application","message":"Starting Gh42183Application using Java 17.0.12 with PID 18901 (\/Users\/awilkinson\/Downloads\/gh-42183\/build\/classes\/java\/main started by awilkinson in \/Users\/awilkinson\/Downloads\/gh-42183)","ecs.version":"8.11"}
{"@timestamp":"2024-09-09T08:57:59.102902Z","log.level":"INFO","process.pid":18901,"process.thread.name":"main","service.name":"gh-42183","log.logger":"com.example.gh_42183.Gh42183Application","message":"No active profile set, falling back to 1 default profile: \"default\"","ecs.version":"8.11"}
{"@timestamp":"2024-09-09T08:57:59.436858Z","log.level":"INFO","process.pid":18901,"process.thread.name":"main","service.name":"gh-42183","log.logger":"com.example.gh_42183.Gh42183Application","message":"Started Gh42183Application in 0.622 seconds (process running for 0.872)","ecs.version":"8.11"}

If you would like us to spend some more time investigating, please spend some time providing a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.

Comment From: sergey-morenets

Hi @wilkinsona

Yes, you're correct. I put new property into non-used property file. Closing.