Giter Site home page Giter Site logo

Comments (3)

mhalbritter avatar mhalbritter commented on May 25, 2024

Hello,

what are you trying to achieve? If you're trying to use correlated logging (log span and trace ids), Spring Boot 3.2.x supports this out of the box: https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#actuator.micrometer-tracing.logging

If that doesn't fix your issue, please attach a sample project which we can unzip or clone. Thanks!

from spring-boot.

Mr-LiuDC avatar Mr-LiuDC commented on May 25, 2024

As shown in the screenshot, in spring boot 3.2.5 the application name, log span and trace ids are displayed repeatedly, only the logging.pattern.level in green is enough.

from spring-boot.

mhalbritter avatar mhalbritter commented on May 25, 2024

The duplicated application name, span id and trace id in the logs with Boot 3.2.x are happening because you set the logging pattern for the level to include them:

logging.pattern.level=%5p [${spring.application.name:},%X{traceId:-},%X{spanId:-}]

this works in Boot 3.1.x, as Boot 3.1.x has no built-in support itself for trace id and span id.

In Boot 3.2.x, this support has been added. There's a new property called logging.pattern.correlation, which contains the trace id and the span id, and which is logged by default if tracing is enabled in the application. Additionally, there's logging.include-application-name which defaults to true and adds the application name to the log.

So now there are multiple variables (logging.pattern.level and logging.pattern.correlation and logging.include-application-name) which contain the application name, trace id and span id. Hence the duplicated stuff in your screenshot.

To fix your setup in 3.2.x, remove [${spring.application.name:},%X{traceId:-},%X{spanId:-}] from logging.pattern.level and, if you need to customize trace id / span id logging, use logging.pattern.correlation.

I'm going to add something to the upgrade guide about that.

from spring-boot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.