forked from aliyun/aliyun-log-logback-appender
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogback-example.xml
82 lines (69 loc) · 2.94 KB
/
logback-example.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
<configuration>
<!--为了防止进程退出时,内存中的数据丢失,请加上此选项-->
<shutdownHook class="ch.qos.logback.core.hook.DelayingShutdownHook"/>
<appender name="loghubAppender1" class="com.aliyun.openservices.log.logback.LoghubAppender">
<!--必选项-->
<!-- 账号及网络配置 -->
<endpoint></endpoint>
<accessKeyId></accessKeyId>
<accessKey></accessKey>
<!-- sls 项目配置 -->
<projectName>test-proj</projectName>
<logstore>store1</logstore>
<!--必选项 (end)-->
<!-- 可选项 -->
<topic>topic1</topic>
<source>source1</source>
<!-- 可选项 详见 '参数说明'-->
<packageTimeoutInMS>3000</packageTimeoutInMS>
<logsCountPerPackage>4096</logsCountPerPackage>
<logsBytesPerPackage>3145728</logsBytesPerPackage>
<memPoolSizeInByte>104857600</memPoolSizeInByte>
<retryTimes>3</retryTimes>
<maxIOThreadSizeInPool>8</maxIOThreadSizeInPool>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"><!-- 打印WARN,ERROR级别的日志 -->
<level>WARN</level>
</filter>
</appender>
<appender name="loghubAppender2" class="com.aliyun.openservices.log.logback.LoghubAppender">
<!--必选项-->
<!-- 账号及网络配置 -->
<endpoint></endpoint>
<accessKeyId></accessKeyId>
<accessKey></accessKey>
<!-- sls 项目配置 -->
<projectName>test-proj</projectName>
<logstore>store2</logstore>
<!--必选项 (end)-->
<!-- 可选项 -->
<topic>topic2</topic>
<source>source2</source>
<!-- 可选项 详见 '参数说明'-->
<packageTimeoutInMS>3000</packageTimeoutInMS>
<logsCountPerPackage>4096</logsCountPerPackage>
<logsBytesPerPackage>3145728</logsBytesPerPackage>
<memPoolSizeInByte>104857600</memPoolSizeInByte>
<retryTimes>3</retryTimes>
<maxIOThreadSizeInPool>8</maxIOThreadSizeInPool>
<filter class="ch.qos.logback.classic.filter.LevelFilter"><!-- 只打印INFO级别的日志 -->
<level>INFO</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<!-- encoders are assigned the type ch.qos.logback.classic.encoder.PatternLayoutEncoder
by default -->
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n</pattern>
</encoder>
</appender>
<!-- 可用来获取StatusManager中的状态 -->
<statusListener class="ch.qos.logback.core.status.OnConsoleStatusListener"/>
<root>
<level value="DEBUG"/>
<appender-ref ref="loghubAppender1"/>
<appender-ref ref="loghubAppender2"/>
<appender-ref ref="STDOUT"/>
</root>
</configuration>