You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+23-5
Original file line number
Diff line number
Diff line change
@@ -6,6 +6,8 @@ This small library provides an appender for [logback](https://logback.qos.ch) (a
6
6
7
7
The appender pushes log entries to LogDNA via HTTPS
8
8
9
+
Logback's thread-bound storage, the MDC, is sent to LogDNA as metadata to be indexed and then searchable. (See screenshot, and more below)
10
+
9
11
## How To
10
12
11
13
Logback uses XML file in known locations with the most common being `classpath:/logback.xml`
@@ -67,7 +69,7 @@ and has some sensible options for dealing with buffer management. [Read more her
67
69
<dependency>
68
70
<groupId>net._95point2.utils</groupId>
69
71
<artifactId>logback-logdna</artifactId>
70
-
<version>1.0.0</version>
72
+
<version>1.1.0</version>
71
73
</dependency>
72
74
73
75
#### Or, plain ol' download
@@ -76,19 +78,35 @@ Or just download the Jar and it's dependencies from https://github.com/robshep/l
76
78
77
79
## Configure
78
80
79
-
You can go to town on most other logback configurations but the LogDNA only has a couple of settings
81
+
You can go to town on most other logback configurations but the LogDNA only has a couple of settings (shown as the default)
80
82
81
83
*`<appName>LogDNA-Logback-Test</appName>` set this for good log management in LogDNA
82
84
*`<ingestKey>${LOGDNA_INGEST_KEY}</ingestKey>` signup to LogDNA and find this in your account profile
83
85
*`<includeStacktrace>true</includeStacktrace>` this library can send multiline stacktraces (see image) - Raw syslog transport cannot
86
+
*`<sendMDC>true</sendMDC>` copies over logback's Mapped Diagnostic Context [(MDC)](https://logback.qos.ch/manual/mdc.html) as LogDNA Metadata which are then indexed and searchable.
84
87
85
88
## More Info
86
89
87
90
* The log line displays the thread, the logger (class) and the message
88
-
91
+
* LogDNA's metadata is populated with the logger as an indexable/searchable property.
89
92
* The HTTP Transport is done by the very lightweight [DavidWebb](https://github.com/hgoebl/DavidWebb) REST Library and so doesn't introduce bulky dependencies
90
93
94
+
## Using the MDC for Meta Data
95
+
96
+
The combination of logback's MDC and LogDNA's metadata support is pretty powerful and means you can correlate web-requests, or a userId, or something else that happens in a thread in your application.
97
+
98
+
For example, doing this _anywhere_ in your application...
99
+
100
+
MDC.put("customerId", "C-1");
101
+
MDC.put("requestId", "cafebabe1");
102
+
103
+
... means that you can then go and search for say, **that** customer in logDNA like this:
104
+
105
+
meta.customerId:"C-1"
106
+
107
+
108
+
91
109
92
-
## Screenshot of the LogDNA log viewer
110
+
## Screenshot of the LogDNA log viewer, including extra metadata
0 commit comments