-
Notifications
You must be signed in to change notification settings - Fork 224
/
logback.xml
executable file
·115 lines (102 loc) · 5.02 KB
/
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ Copyright (c) 2017 Contributors to the Eclipse Foundation
~
~ See the NOTICE file(s) distributed with this work for additional
~ information regarding copyright ownership.
~
~ This program and the accompanying materials are made available under the
~ terms of the Eclipse Public License 2.0 which is available at
~ http://www.eclipse.org/legal/epl-2.0
~
~ SPDX-License-Identifier: EPL-2.0
-->
<configuration>
<statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener"/>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%date{ISO8601} %-5level [%X{correlation-id}][%X{traceparent}] %logger{20} %X{pekkoSource} - %msg%n</pattern>
</encoder>
</appender>
<appender name="STDERR" class="ch.qos.logback.core.ConsoleAppender">
<target>System.err</target>
<encoder>
<pattern>%date{ISO8601} %-5level [%X{correlation-id}][%X{traceparent}] %logger{20} %X{pekkoSource} - %msg%n</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
</appender>
<if condition='isDefined("DITTO_LOGGING_LOGSTASH_SERVER")'>
<then>
<appender name="stash" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<destination>${DITTO_LOGGING_LOGSTASH_SERVER}</destination>
<reconnectionDelay>1 second</reconnectionDelay>
<!-- Encoder is required -->
<encoder class="net.logstash.logback.encoder.LogstashEncoder">
<customFields>{"appname":"policies","instance_index":"${INSTANCE_INDEX}"</customFields>
</encoder>
</appender>
</then>
</if>
<if condition='property("DITTO_LOGGING_FILE_APPENDER").equals("true")'>
<then>
<appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>${DITTO_LOGGING_FILE_APPENDER_THRESHOLD:-info}</level>
</filter>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- The rollover period is inferred from the fileNamePattern -->
<!-- daily rollover as default -->
<fileNamePattern>${DITTO_LOGGING_FILE_NAME_PATTERN:-/var/log/ditto/policies.log.%d{yyyy-MM-dd}.gz}</fileNamePattern>
<!-- Keep 10 days' worth of history capped at 1GB total size as default -->
<!-- maxHistory is based on the rollover period of the fileNamePattern -->
<maxHistory>${DITTO_LOGGING_MAX_LOG_FILE_HISTORY:-10}</maxHistory>
<totalSizeCap>${DITTO_LOGGING_TOTAL_LOG_FILE_SIZE:-1GB}</totalSizeCap>
<cleanHistoryOnStart>${DITTO_LOGGING_CLEAN_HISTORY_ON_START:-false}</cleanHistoryOnStart>
</rollingPolicy>
<encoder class="net.logstash.logback.encoder.LogstashEncoder">
<customFields>{"appname":"policies","instance_index":"${INSTANCE_INDEX}"}</customFields>
</encoder>
</appender>
</then>
</if>
<!-- Do not print INFO cluster messages of mongo driver: -->
<logger name="org.mongodb.driver" level="WARN"/>
<logger name="org.apache.pekko.management.cluster.bootstrap.contactpoint.HttpClusterBootstrapRoutes" level="WARN"/>
<logger name="org.apache.pekko.management.cluster.bootstrap.internal.BootstrapCoordinator" level="WARN"/>
<logger name="org.apache.pekko.actor.CoordinatedShutdown" level="DEBUG"/>
<!-- Log level for the application -->
<logger name="org.eclipse.ditto" level="${LOG_LEVEL_APPLICATION:-INFO}"/>
<root level="${LOG_LEVEL:-INFO}">
<!-- Logging INFO messages can be disabled by setting environment variable -->
<if condition='isDefined("DITTO_LOGGING_DISABLE_SYSOUT_LOG")'>
<then>
<if condition='property("DITTO_LOGGING_DISABLE_SYSOUT_LOG").equals("true")'>
<then>
<!-- don't use the "STDOUT" appender -->
</then>
<else>
<appender-ref ref="STDOUT"/>
</else>
</if>
</then>
<else>
<!-- if not defined, assume logging to STDOUT is desired -->
<appender-ref ref="STDOUT"/>
</else>
</if>
<!-- Always log ERRORs to syserr -->
<appender-ref ref="STDERR"/>
<if condition='isDefined("DITTO_LOGGING_LOGSTASH_SERVER")'>
<then>
<appender-ref ref="stash"/>
</then>
</if>
<if condition='property("DITTO_LOGGING_FILE_APPENDER").equals("true")'>
<then>
<appender-ref ref="file"/>
</then>
</if>
</root>
</configuration>