ITNEXT

ITNEXT is a platform for IT developers & software engineers to share knowledge, connect, collaborate, learn and experience next-gen technologies.

Follow publication

Deep dive into the Structured Logging in Spring Boot 3.4

Benefits of Structured Logging

Saeed Zarinfam
ITNEXT
Published in
4 min readDec 2, 2024

--

Spring Boot 3.4 has been released 🎊, and as usual, I want to introduce you to some of its new features. As I use Spring Framework and Spring Boot in my daily work, I always keep an eye on the new features that are added in the new releases and write about them here:

🍃 Spring Zone

22 stories

This time, unlike the previous times, instead of introducing all the features in one article, I want to go into each feature as deeply as I can. The first feature in Spring Boot 3.4 that I would like to introduce in this article is the most buzzed around: Structured Logging.

Spring Boot 3.4 — Structured Logging

· Why Structured Logging Matters?
· How to enable Structured Logging in Spring Boot 3.4?
· Let’s see what happens in practice
Using Elastic Common Schema (ECS) format:
Using Graylog Extended Log Format (GELF):
Using Logstash JSON format:
· Implementing custom format
· Some tips:
· Final Thoughts

Why Structured Logging Matters?

Structured logging enables us to produce log outputs in a clear and machine-readable style.

By utilizing structured logging, we can effectively capture and organize log information, making it easier to parse and analyze with other tools. This approach not only enhances the readability of logs for humans but also streamlines the process of aggregating and searching through log data, ultimately leading to more efficient debugging and monitoring of applications.

Spring Boot 3.4 introduces built-in support for structured logging and out-of-the-box supports the following JSON formats:

  • Elastic Common Schema (ecs)
  • Graylog Extended Log Format (gelf)
  • Logstash (logstash)

How do you enable Structured Logging in Spring Boot 3.4?

--

--

Published in ITNEXT

ITNEXT is a platform for IT developers & software engineers to share knowledge, connect, collaborate, learn and experience next-gen technologies.

Written by Saeed Zarinfam

✍️ I write about Software Development, including Java, Go, Spring, Containers, K8s, AI, Observability, and more ⋈

Responses (3)

Write a response