This repository has been archived by the owner on May 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 59
/
sample.logback.xml
36 lines (35 loc) · 1.79 KB
/
sample.logback.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<configuration>
<!--Use TCP instead of UDP-->
<appender name="GELF TCP APPENDER" class="me.moocar.logback.net.SocketEncoderAppender">
<remoteHost>somehost.com</remoteHost>
<port>12201</port>
<encoder class="ch.qos.logback.core.encoder.LayoutWrappingEncoder">
<layout class="me.moocar.logbackgelf.GelfLayout">
<!--An example of overwriting the short message pattern-->
<shortMessageLayout class="ch.qos.logback.classic.PatternLayout">
<pattern>%ex{short}%.100m</pattern>
</shortMessageLayout>
<!-- Use HTML output of the full message. Yes, any layout can be used (please don't actually do this)-->
<fullMessageLayout class="ch.qos.logback.classic.html.HTMLLayout">
<pattern>%relative%thread%mdc%level%logger%msg</pattern>
</fullMessageLayout>
<useLoggerName>true</useLoggerName>
<useThreadName>true</useThreadName>
<useMarker>true</useMarker>
<host>Test</host>
<additionalField>ipAddress:_ip_address</additionalField>
<additionalField>requestId:_request_id</additionalField>
<includeFullMDC>true</includeFullMDC>
<fieldType>requestId:long</fieldType>
<!--Facility is not officially supported in GELF anymore, but you can use staticAdditionalFields to do the same thing-->
<staticField class="me.moocar.logbackgelf.Field">
<key>_facility</key>
<value>GELF</value>
</staticField>
</layout>
</encoder>
</appender>
<root level="debug">
<appender-ref ref="GELF TCP APPENDER" />
</root>
</configuration>