Giter Site home page Giter Site logo

kamon-tracetoken-bug's Introduction

This project reproduces the bug when the AsyncAppender is used.

To generate the logs, invoke the following after sbt run:

curl localhost:8080/build -v

When the AsyncAppender is used, the following log lines are emitted:

[info] {sourceThread=kamon-akka.actor.default-dispatcher-4, akkaSource=BuildInfoController(akka://kamon), sourceActorSystem=kamon, traceName=UnnamedTrace, traceToken=ubuntu-2, akkaTimestamp=06:06:33.458UTC}
[info] 2016-11-09 22:06:33.459 INFO  io.kamon.sample.BuildInfoController 06:06:33.458UTC [undefined] - getting build information!

The first line is a debug printout of the MDC map.

Notice undefined which never gets resolved. When stepping into the code, the conversionRule used in logback.xml refers to LogbackTraceTokenConverter. Inside the method, the Tracer.currentContext is empty. However, the MDC values are indeed present. Why does the context turn out to be empty?

When I do remove the AsyncAppender in the logback config (i.e., switching the appender from ASYNC_CONSOLE to CONSOLE), the Tracer.currentContext is not empty as follows:

[info] {traceName=UnnamedTrace, traceToken=ubuntu-1, sourceThread=kamon-akka.actor.default-dispatcher-4, akkaTimestamp=06:12:23.565UTC, akkaSource=BuildInfoController(akka://kamon), sourceActorSystem=kamon}
[info] 2016-11-09 22:12:23.575 INFO  io.kamon.sample.BuildInfoController 06:12:23.565UTC [ubuntu-1] - getting build information!

kamon-tracetoken-bug's People

Contributors

dpsoft avatar neowulf avatar

Watchers

 avatar  avatar

Forkers

dpsoft

kamon-tracetoken-bug's Issues

fix traceToken bug

@neowulf33 you only need change this

   <property name="LOG_ENCODER_PATTERN"
              value="%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %logger{36} %X{akkaTimestamp} [%traceToken] - %msg%n"
    />

to

 <property name="LOG_ENCODER_PATTERN"
              value="%d{yyyy-MM-dd HH:mm:ss.SSS} %-5level %logger{36} %X{akkaTimestamp} [%X{traceToken}] - %msg%n"
    />

in order to extract the traceToken from MDC

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.