Skip to content

Commit 844acfd

Browse files
authored
fix: fix circuitbreaker-logger (#210)
1 parent d2f2af8 commit 844acfd

File tree

12 files changed

+432
-24
lines changed

12 files changed

+432
-24
lines changed
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
4+
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/" debug="false">
5+
<appender name="POLARIS_LOG_FILE" class="org.apache.log4j.RollingFileAppender">
6+
<param name="File" value="${polaris.log.home}/polaris.log"/>
7+
<param name="Append" value="true"/>
8+
<param name="MaxBackupIndex" value="10"/>
9+
<param name="MaxFileSize" value="10MB"/>
10+
<layout class="org.apache.log4j.PatternLayout">
11+
<param name="ConversionPattern"
12+
value="[%d{yyyy-MM-dd HH:mm:ss:SSS}] [%-5p] [method:%l]%n%m%n%n"/>
13+
</layout>
14+
</appender>
15+
<appender name="POLARIS_UPDATE_EVENT_LOG_FILE" class="org.apache.log4j.RollingFileAppender">
16+
<param name="File" value="${polaris.log.home}/polaris-update-event.log"/>
17+
<param name="Append" value="true"/>
18+
<param name="MaxBackupIndex" value="10"/>
19+
<param name="MaxFileSize" value="10MB"/>
20+
<layout class="org.apache.log4j.PatternLayout">
21+
<param name="ConversionPattern"
22+
value="[%d{yyyy-MM-dd HH:mm:ss:SSS}] [%-5p] [method:%l]%n%m%n%n"/>
23+
</layout>
24+
</appender>
25+
<appender name="POLARIS_UPDATE_EVENT_LOG_FILE_ASYNC" class="org.apache.log4j.AsyncAppender">
26+
<param name="BufferSize" value="512"/>
27+
<param name="Blocking" value="false"/>
28+
<appender-ref ref="POLARIS_UPDATE_EVENT_LOG_FILE"/>
29+
</appender>
30+
<appender name="POLARIS_CIRCUIT_BREAKER_EVENT_LOG_FILE"
31+
class="org.apache.log4j.RollingFileAppender">
32+
<param name="File" value="${polaris.log.home}/polaris-circuitbreaker.log"/>
33+
<param name="Append" value="true"/>
34+
<param name="MaxBackupIndex" value="10"/>
35+
<param name="MaxFileSize" value="10MB"/>
36+
<layout class="org.apache.log4j.PatternLayout">
37+
<param name="ConversionPattern"
38+
value="[%d{yyyy-MM-dd HH:mm:ss:SSS}] [%-5p] [method:%l]%n%m%n%n"/>
39+
</layout>
40+
</appender>
41+
<appender name="POLARIS_HEALTH_CHECK_EVENT_LOG_FILE"
42+
class="org.apache.log4j.RollingFileAppender">
43+
<param name="File" value="${polaris.log.home}/polaris-healthcheck-event.log"/>
44+
<param name="Append" value="true"/>
45+
<param name="MaxBackupIndex" value="10"/>
46+
<param name="MaxFileSize" value="10MB"/>
47+
<layout class="org.apache.log4j.PatternLayout">
48+
<param name="ConversionPattern"
49+
value="[%d{yyyy-MM-dd HH:mm:ss:SSS}] [%-5p] [method:%l]%n%m%n%n"/>
50+
</layout>
51+
</appender>
52+
<appender name="POLARIS_LOSSLESS_EVENT_LOG_FILE"
53+
class="org.apache.log4j.RollingFileAppender">
54+
<param name="File" value="${polaris.log.home}/polaris-lossless-event.log"/>
55+
<param name="Append" value="true"/>
56+
<param name="MaxBackupIndex" value="10"/>
57+
<param name="MaxFileSize" value="10MB"/>
58+
<layout class="org.apache.log4j.PatternLayout">
59+
<param name="ConversionPattern"
60+
value="%m|[%d{yyyy-MM-dd HH:mm:ss:SSS}]%n"/>
61+
</layout>
62+
</appender>
63+
<appender name="POLARIS_INSTANCE_HEARTBEAT_LOG_FILE"
64+
class="org.apache.log4j.RollingFileAppender">
65+
<param name="File" value="${polaris.log.home}/polaris-instance-heartbeat.log"/>
66+
<param name="Append" value="true"/>
67+
<param name="MaxBackupIndex" value="10"/>
68+
<param name="MaxFileSize" value="10MB"/>
69+
<layout class="org.apache.log4j.PatternLayout">
70+
<param name="ConversionPattern"
71+
value="%m|[%d{yyyy-MM-dd HH:mm:ss:SSS}]%n"/>
72+
</layout>
73+
</appender>
74+
75+
<logger name="com.tencent.polaris" additivity="false">
76+
<level value="INFO"/>
77+
<appender-ref ref="POLARIS_LOG_FILE"/>
78+
</logger>
79+
<logger name="polaris-update-event" additivity="false">
80+
<level value="INFO"/>
81+
<appender-ref ref="POLARIS_UPDATE_EVENT_LOG_FILE"/>
82+
</logger>
83+
<logger name="polaris-update-event-async" additivity="false">
84+
<level value="INFO"/>
85+
<appender-ref ref="POLARIS_UPDATE_EVENT_LOG_FILE_ASYNC"/>
86+
</logger>
87+
<logger name="polaris-circuitbreaker" additivity="false">
88+
<level value="INFO"/>
89+
<appender-ref ref="POLARIS_CIRCUIT_BREAKER_EVENT_LOG_FILE"/>
90+
</logger>
91+
<logger name="polaris-healthcheck-event" additivity="false">
92+
<level value="INFO"/>
93+
<appender-ref ref="POLARIS_HEALTH_CHECK_EVENT_LOG_FILE"/>
94+
</logger>
95+
<logger name="polaris-lossless-event" additivity="false">
96+
<level value="INFO"/>
97+
<appender-ref ref="POLARIS_LOSSLESS_EVENT_LOG_FILE"/>
98+
</logger>
99+
<logger name="polaris-instance-heartbeat" additivity="false">
100+
<level value="INFO"/>
101+
<appender-ref ref="POLARIS_INSTANCE_HEARTBEAT_LOG_FILE"/>
102+
</logger>
103+
</log4j:configuration>
Lines changed: 142 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<Configuration status="WARN">
4+
<Appenders>
5+
<Console name="Console" target="SYSTEM_OUT">
6+
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n"/>
7+
</Console>
8+
<RollingFile name="POLARIS_LOG_FILE" fileName="${sys:polaris.log.home}/polaris.log"
9+
filePattern="${sys:polaris.log.home}/polaris.log.%d{yyyy-MM-dd}.%i">
10+
<PatternLayout>
11+
<Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %p [%-5t:%c{2}] %m%n</Pattern>
12+
</PatternLayout>
13+
14+
<Policies>
15+
<TimeBasedTriggeringPolicy/>
16+
<SizeBasedTriggeringPolicy size="${sys:polaris.log.file.size:-10MB}"/>
17+
</Policies>
18+
19+
<DefaultRolloverStrategy max="${sys:polaris.log.retain.count:-7}"/>
20+
</RollingFile>
21+
22+
<RollingFile name="POLARIS_UPDATE_EVENT_LOG_FILE"
23+
fileName="${sys:polaris.log.home}/polaris-update-event.log"
24+
filePattern="${sys:polaris.log.home}/polaris-update-event.log.%d{yyyy-MM-dd}.%i">
25+
<PatternLayout>
26+
<Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %p [%-5t:%c{2}] %m%n</Pattern>
27+
</PatternLayout>
28+
29+
<Policies>
30+
<TimeBasedTriggeringPolicy/>
31+
<SizeBasedTriggeringPolicy size="${sys:polaris.update.event.log.file.size:-10MB}"/>
32+
</Policies>
33+
34+
<DefaultRolloverStrategy max="${sys:polaris.update.event.log.retain.count:-7}"/>
35+
</RollingFile>
36+
37+
<RollingFile name="POLARIS_CIRCUIT_BREAKER_EVENT_LOG_FILE"
38+
fileName="${sys:polaris.log.home}/polaris-circuitbreaker.log"
39+
filePattern="${sys:polaris.log.home}/polaris-circuitbreaker.log.%d{yyyy-MM-dd}.%i">
40+
<PatternLayout>
41+
<Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %p [%-5t:%c{2}] %m%n</Pattern>
42+
</PatternLayout>
43+
44+
<Policies>
45+
<TimeBasedTriggeringPolicy/>
46+
<SizeBasedTriggeringPolicy
47+
size="${sys:polaris.circuitbreaker.event.log.file.size:-10MB}"/>
48+
</Policies>
49+
50+
<DefaultRolloverStrategy max="${sys:polaris.circuitbreaker.event.log.retain.count:-7}"/>
51+
</RollingFile>
52+
53+
<RollingFile name="POLARIS_HEALTH_CHECK_EVENT_LOG_FILE"
54+
fileName="${sys:polaris.log.home}/polaris-healthcheck-event"
55+
filePattern="${sys:polaris.log.home}/polaris-healthcheck-event.log.%d{yyyy-MM-dd}.%i">
56+
<PatternLayout>
57+
<Pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} %p [%-5t:%c{2}] %m%n</Pattern>
58+
</PatternLayout>
59+
60+
<Policies>
61+
<TimeBasedTriggeringPolicy/>
62+
<SizeBasedTriggeringPolicy
63+
size="${sys:polaris.healthcheck.event.log.file.size:-10MB}"/>
64+
</Policies>
65+
66+
<DefaultRolloverStrategy max="${sys:polaris.healthcheck.event.log.retain.count:-7}"/>
67+
</RollingFile>
68+
69+
<RollingFile name="POLARIS_LOSSLESS_EVENT_LOG_FILE"
70+
fileName="${sys:polaris.log.home}/polaris-lossless-event"
71+
filePattern="${sys:polaris.log.home}/polaris-lossless-event.log.%d{yyyy-MM-dd}.%i">
72+
<PatternLayout>
73+
<Pattern>%m|%d{yyyy-MM-dd HH:mm:ss.SSS}%n</Pattern>
74+
</PatternLayout>
75+
76+
<Policies>
77+
<TimeBasedTriggeringPolicy/>
78+
<SizeBasedTriggeringPolicy
79+
size="${sys:polaris.lossless.event.log.file.size:-10MB}"/>
80+
</Policies>
81+
82+
<DefaultRolloverStrategy max="${sys:polaris.lossless.event.log.retain.count:-7}"/>
83+
</RollingFile>
84+
85+
<RollingFile name="POLARIS_INSTANCE_HEARTBEAT_LOG_FILE"
86+
fileName="${sys:polaris.log.home}/polaris-instance-heartbeat"
87+
filePattern="${sys:polaris.log.home}/polaris-instance-heartbeat.log.%d{yyyy-MM-dd}.%i">
88+
<PatternLayout>
89+
<Pattern>%m|%d{yyyy-MM-dd HH:mm:ss.SSS}%n</Pattern>
90+
</PatternLayout>
91+
92+
<Policies>
93+
<TimeBasedTriggeringPolicy/>
94+
<SizeBasedTriggeringPolicy
95+
size="${sys:polaris.instance.heartbeat.log.file.size:-10MB}"/>
96+
</Policies>
97+
98+
<DefaultRolloverStrategy max="${sys:polaris.instance.heartbeat.log.retain.count:-7}"/>
99+
</RollingFile>
100+
</Appenders>
101+
102+
<Loggers>
103+
<Root level="info">
104+
<AppenderRef ref="Console"/>
105+
</Root>
106+
<Logger name="com.tencent.polaris"
107+
level="${sys:polaris.log.level:-info}"
108+
additivity="false">
109+
<AppenderRef ref="POLARIS_LOG_FILE"/>
110+
</Logger>
111+
<Logger name="polaris-update-event-async"
112+
level="${sys:polaris.update.event.log.level:-info}"
113+
additivity="false">
114+
<AppenderRef ref="POLARIS_UPDATE_EVENT_LOG_FILE"/>
115+
</Logger>
116+
<Logger name="polaris-circuitbreaker"
117+
level="${sys:polaris.circuitbreaker.event.log.level:-info}"
118+
additivity="false">
119+
<AppenderRef ref="POLARIS_CIRCUIT_BREAKER_EVENT_LOG_FILE"/>
120+
</Logger>
121+
<Logger name="polaris-healthcheck-event"
122+
level="${sys:polaris.healthcheck.event.log.level:-info}"
123+
additivity="false">
124+
<AppenderRef ref="POLARIS_HEALTH_CHECK_EVENT_LOG_FILE"/>
125+
</Logger>
126+
<!-- <AsyncLogger name="polaris-update-event-async"-->
127+
<!-- level="${sys:polaris-update-event.log.level:-info}"-->
128+
<!-- additivity="false">-->
129+
<!-- <AppenderRef ref="POLARIS_UPDATE_EVENT_LOG_FILE"/>-->
130+
<!-- </AsyncLogger>-->
131+
<Logger name="polaris-lossless-event"
132+
level="${sys:polaris.lossless.event.log.level:-info}"
133+
additivity="false">
134+
<AppenderRef ref="POLARIS_LOSSLESS_EVENT_LOG_FILE"/>
135+
</Logger>
136+
<Logger name="polaris-instance-heartbeat"
137+
level="${sys:polaris.instance.heartbeat.log.level:-info}"
138+
additivity="false">
139+
<AppenderRef ref="POLARIS_INSTANCE_HEARTBEAT_LOG_FILE"/>
140+
</Logger>
141+
</Loggers>
142+
</Configuration>

0 commit comments

Comments
 (0)