-
Notifications
You must be signed in to change notification settings - Fork 2
/
logback.xml
70 lines (65 loc) · 3.19 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
<configuration>
<!-- PLEASE set to values appropriate for YOUR environment -->
<!-- example properties for your reference -->
<property name="ENVIRONMENT" value="development"/>
<property name="LOG_DIR" value="/tmp/logs"/>
<property name="MAX_HISTORY_MAIN_LOG" value="10"/>
<property name="MAX_SIZE_MAIN_LOG" value="10KB"/>
<property name="MAX_HISTORY_FAILED_LOG" value="5"/>
<property name="MAX_SIZE_FAILED_LOG" value="10MB"/>
<!-- end of example properties -->
<appender name="STDOUT"
class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>%d{dd/MMM/yyyy:HH:mm:ss:SSS Z} [%thread] %-5level %logger{36} - %msg%n</pattern>
</layout>
</appender>
<appender name="MAIN_LOGS" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_DIR}/kafka_batch_processor.log</file>
<append>true</append>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- rollover daily -->
<fileNamePattern>${LOG_DIR}/kafka_es_indexer-%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<!-- keep ${MAX_HISTORY_MAIN_LOG} days' worth of history -->
<maxHistory>${MAX_HISTORY_MAIN_LOG}</maxHistory>
<!-- or whenever the file size reaches ${MAX_SIZE_MAIN_LOG} -->
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>${MAX_SIZE_MAIN_LOG}</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss:SSS,SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<appender name="FAILED_EVENTS" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_DIR}/failed_es_events.log</file>
<append>true</append>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- rollover daily -->
<fileNamePattern>${LOG_DIR}/failed_es_events-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<maxHistory>${MAX_HISTORY_FAILED_LOG}</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches max size -->
<maxFileSize>${MAX_SIZE_FAILED_LOG}</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>[%d{dd/MMM/yyyy:HH:mm:ss:SSS Z}] %msg%n</pattern>
</encoder>
</appender>
<logger name="org.bigdatadevs.kafkabatch.FailedEventsLogger" level="error">
<appender-ref ref="FAILED_EVENTS"/>
</logger>
<logger name="org.bigdatadevs.kafkabatch" level="info">
<appender-ref ref="MAIN_LOGS"/>
<if condition='property("ENVIRONMENT").contains("development")'>
<then>
<appender-ref ref="STDOUT"/>
</then>
</if>
</logger>
<logger name="org.apache.kafka" level="info">
<appender-ref ref="STDOUT"/>
</logger>
</configuration>