diff options
author | Ivan Topolnjak <ivantopo@gmail.com> | 2014-03-17 01:04:38 -0300 |
---|---|---|
committer | Ivan Topolnjak <ivantopo@gmail.com> | 2014-03-17 01:04:38 -0300 |
commit | 15367bdf6c131d039713116734a4e0d8b11ec9a0 (patch) | |
tree | 2f53256cfed17a809f1b83460b19b8a647d5735f /site/src/main/jekyll/core | |
parent | c56f64e2bbfe58c9f767cf58512317d727c8cd42 (diff) | |
download | Kamon-15367bdf6c131d039713116734a4e0d8b11ec9a0.tar.gz Kamon-15367bdf6c131d039713116734a4e0d8b11ec9a0.tar.bz2 Kamon-15367bdf6c131d039713116734a4e0d8b11ec9a0.zip |
some basic logging documentation
Diffstat (limited to 'site/src/main/jekyll/core')
-rw-r--r-- | site/src/main/jekyll/core/logging.md | 43 | ||||
-rw-r--r-- | site/src/main/jekyll/core/tracing.md (renamed from site/src/main/jekyll/core/trace.md) | 4 |
2 files changed, 45 insertions, 2 deletions
diff --git a/site/src/main/jekyll/core/logging.md b/site/src/main/jekyll/core/logging.md index e69de29b..d8324f82 100644 --- a/site/src/main/jekyll/core/logging.md +++ b/site/src/main/jekyll/core/logging.md @@ -0,0 +1,43 @@ +--- +title: Kamon | Core | Documentation +layout: default +--- + +Logging +======= + +Kamon provides a very simple way to make sure that the trace token available when the log statement was executed is +included in your logs, no matter if you are logging synchronously or asynchronously. Kamon provides built in support +for logging with Logback, but extending the support to any other logging framework should be a trivial task. + +When using `ActorLogging` all logging events are sent to your actor system's event stream and then picked up by your +registered listeners for actual logging. Akka captures the actor, thread and timestamp from the instant in which the +event was generated and makes that info available when performing the actual logging. As an addition to this, Kamon +attaches the `TraceContext` that is present when creating the log events and makes it available when the actual logging +is performed. If you are using the loggers directly then the `TraceContext` should be already available. + +`TraceRecorder.currentContext` gives you access to the currently `TraceContext`, so the following expression gives you +the trace token for the currently available context: + +```scala +TraceRecorder.currentContext.map(_.token) +``` + +Kamon already packs a Logback converter that you can register in your `logback.xml` file and use in your logging +patterns as show bellow: + +```xml +<configuration scan="true"> + <conversionRule conversionWord="traceToken" converterClass="kamon.trace.logging.LogbackTraceTokenConverter" /> + <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> + <encoder> + <pattern>%date{HH:mm:ss.SSS} %-5level [%traceToken][%X{akkaSource}] %msg%n</pattern> + </encoder> + </appender> + + <root level="debug"> + <appender-ref ref="STDOUT" /> + </root> + +</configuration> +``` diff --git a/site/src/main/jekyll/core/trace.md b/site/src/main/jekyll/core/tracing.md index fea0f24b..bf79bd47 100644 --- a/site/src/main/jekyll/core/trace.md +++ b/site/src/main/jekyll/core/tracing.md @@ -88,8 +88,8 @@ has become a no brainer: each `TraceContext` created by Kamon gets a unique toke patterns (the first value between square brackets) and with that small but important piece of information the relation between each log line is clear. -Just by logging the trace token you get a lot of information, refer to the logging section to learn how to log the trace -token in your application. +Just by logging the trace token you can get a lot of visibility and coherence in the information available on your logs, +please refer to the [logging](../logging/) section to learn how to include the trace token in your logs. Rules for `TraceContext` Propagation |