Skip to content

Commit 2a4efde

Browse files
authored
[SCB-2734]configure access log and metrics (#41)
1 parent f94b116 commit 2a4efde

File tree

12 files changed

+360
-172
lines changed

12 files changed

+360
-172
lines changed

authentication-server/src/main/resources/log4j2.xml

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Licensed to the Apache Software Foundation (ASF) under one or more
4+
~ contributor license agreements. See the NOTICE file distributed with
5+
~ this work for additional information regarding copyright ownership.
6+
~ The ASF licenses this file to You under the Apache License, Version 2.0
7+
~ (the "License"); you may not use this file except in compliance with
8+
~ the License. You may obtain a copy of the License at
9+
~
10+
~ http://www.apache.org/licenses/LICENSE-2.0
11+
~
12+
~ Unless required by applicable law or agreed to in writing, software
13+
~ distributed under the License is distributed on an "AS IS" BASIS,
14+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
~ See the License for the specific language governing permissions and
16+
~ limitations under the License.
17+
-->
18+
19+
<!--this is sample configuration, please modify as your wish -->
20+
21+
<configuration scan="true">
22+
23+
<property name="log.path" value="./authentication-server/log/"/>
24+
25+
<appender name="ROOT_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
26+
<file>${log.path}/output.log</file>
27+
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
28+
<fileNamePattern>${log.path}/output%d{yyyy-MM-dd}.log</fileNamePattern>
29+
<maxHistory>1</maxHistory>
30+
<totalSizeCap>10MB</totalSizeCap>
31+
</rollingPolicy>
32+
<encoder>
33+
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{80} - %msg%n</pattern>
34+
</encoder>
35+
</appender>
36+
37+
<appender name="METRICS" class="ch.qos.logback.core.rolling.RollingFileAppender">
38+
<file>${log.path}/metrics.log</file>
39+
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
40+
<fileNamePattern>${log.path}/metrics%d{yyyy-MM-dd}.log</fileNamePattern>
41+
<maxHistory>1</maxHistory>
42+
<totalSizeCap>10MB</totalSizeCap>
43+
</rollingPolicy>
44+
<encoder>
45+
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{80} - %msg%n</pattern>
46+
</encoder>
47+
</appender>
48+
49+
<appender name="ACCESS" class="ch.qos.logback.core.rolling.RollingFileAppender">
50+
<file>${log.path}/access.log</file>
51+
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
52+
<fileNamePattern>${log.path}/access%d{yyyy-MM-dd}.log</fileNamePattern>
53+
<maxHistory>1</maxHistory>
54+
<totalSizeCap>10MB</totalSizeCap>
55+
</rollingPolicy>
56+
<encoder>
57+
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{80} - %msg%n</pattern>
58+
</encoder>
59+
</appender>
60+
61+
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
62+
<encoder>
63+
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{80} - %msg%n</pattern>
64+
</encoder>
65+
</appender>
66+
67+
<logger name="org.apache.servicecomb.metrics.core.publish.DefaultLogPublisher" level="INFO" additivity="false">
68+
<appender-ref ref="METRICS"/>
69+
</logger>
70+
<logger name="accesslog" level="INFO" additivity="false">
71+
<appender-ref ref="ACCESS" />
72+
</logger>
73+
74+
<root level="INFO">
75+
<appender-ref ref="STDOUT"/>
76+
<appender-ref ref="ROOT_FILE"/>
77+
</root>
78+
79+
</configuration>

authentication-server/src/main/resources/microservice.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,17 @@ servicecomb:
3535
rest:
3636
address: 0.0.0.0:9061
3737

38+
accesslog:
39+
## server 端 启用access log
40+
enabled: true
41+
## server 端 自定义 access log 日志格式
42+
pattern: "%h %r %s %B %D"
43+
request:
44+
## client 端开启 request log
45+
enabled: true
46+
## client 端自定义 request log 日志格式
47+
pattern: "%h %SCB-transport %r %s %D"
48+
3849
authentication:
3950
token:
4051
expiresIn: 600

edge-service/src/main/resources/log4j2.xml

Lines changed: 0 additions & 43 deletions
This file was deleted.
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
~ Licensed to the Apache Software Foundation (ASF) under one or more
4+
~ contributor license agreements. See the NOTICE file distributed with
5+
~ this work for additional information regarding copyright ownership.
6+
~ The ASF licenses this file to You under the Apache License, Version 2.0
7+
~ (the "License"); you may not use this file except in compliance with
8+
~ the License. You may obtain a copy of the License at
9+
~
10+
~ http://www.apache.org/licenses/LICENSE-2.0
11+
~
12+
~ Unless required by applicable law or agreed to in writing, software
13+
~ distributed under the License is distributed on an "AS IS" BASIS,
14+
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
~ See the License for the specific language governing permissions and
16+
~ limitations under the License.
17+
-->
18+
19+
<!--this is sample configuration, please modify as your wish -->
20+
21+
<configuration scan="true">
22+
23+
<property name="log.path" value="./edge-service/log/"/>
24+
25+
<appender name="ROOT_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
26+
<file>${log.path}/output.log</file>
27+
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
28+
<fileNamePattern>${log.path}/output%d{yyyy-MM-dd}.log</fileNamePattern>
29+
<maxHistory>1</maxHistory>
30+
<totalSizeCap>10MB</totalSizeCap>
31+
</rollingPolicy>
32+
<encoder>
33+
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{80} - %msg%n</pattern>
34+
</encoder>
35+
</appender>
36+
37+
<appender name="METRICS" class="ch.qos.logback.core.rolling.RollingFileAppender">
38+
<file>${log.path}/metrics.log</file>
39+
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
40+
<fileNamePattern>${log.path}/metrics%d{yyyy-MM-dd}.log</fileNamePattern>
41+
<maxHistory>1</maxHistory>
42+
<totalSizeCap>10MB</totalSizeCap>
43+
</rollingPolicy>
44+
<encoder>
45+
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{80} - %msg%n</pattern>
46+
</encoder>
47+
</appender>
48+
49+
<appender name="ACCESS" class="ch.qos.logback.core.rolling.RollingFileAppender">
50+
<file>${log.path}/access.log</file>
51+
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
52+
<fileNamePattern>${log.path}/access%d{yyyy-MM-dd}.log</fileNamePattern>
53+
<maxHistory>1</maxHistory>
54+
<totalSizeCap>10MB</totalSizeCap>
55+
</rollingPolicy>
56+
<encoder>
57+
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{80} - %msg%n</pattern>
58+
</encoder>
59+
</appender>
60+
61+
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
62+
<encoder>
63+
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{80} - %msg%n</pattern>
64+
</encoder>
65+
</appender>
66+
67+
<logger name="org.apache.servicecomb.metrics.core.publish.DefaultLogPublisher" level="INFO" additivity="false">
68+
<appender-ref ref="METRICS"/>
69+
</logger>
70+
<logger name="accesslog" level="INFO" additivity="false">
71+
<appender-ref ref="ACCESS" />
72+
</logger>
73+
74+
<root level="INFO">
75+
<appender-ref ref="STDOUT"/>
76+
<appender-ref ref="ROOT_FILE"/>
77+
</root>
78+
79+
</configuration>

edge-service/src/main/resources/microservice.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,17 @@ servicecomb:
4343
authentication-server: internalAccess,qps-flowcontrol-consumer,loadbalance
4444
authentication-client: internalAccess,qps-flowcontrol-consumer,loadbalance
4545

46+
accesslog:
47+
## server 端 启用access log
48+
enabled: true
49+
## server 端 自定义 access log 日志格式
50+
pattern: "%h %r %s %B %D"
51+
request:
52+
## client 端开启 request log
53+
enabled: true
54+
## client 端自定义 request log 日志格式
55+
pattern: "%h %SCB-transport %r %s %D"
56+
4657
http:
4758
dispatcher:
4859
edge:

integration-tests/src/main/resources/log4j2.xml

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)