You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicecomb.apache.org by li...@apache.org on 2022/11/30 06:40:11 UTC
[servicecomb-fence] branch master updated: [SCB-2734]configure access log and metrics (#41)
This is an automated email from the ASF dual-hosted git repository.
liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-fence.git
The following commit(s) were added to refs/heads/master by this push:
new 2a4efde [SCB-2734]configure access log and metrics (#41)
2a4efde is described below
commit 2a4efde5bcfc494306afb9f3c0b848c1ea8791b6
Author: liubao68 <bi...@qq.com>
AuthorDate: Wed Nov 30 14:40:06 2022 +0800
[SCB-2734]configure access log and metrics (#41)
---
.../src/main/resources/log4j2.xml | 43 ------------
.../src/main/resources/logback.xml | 79 ++++++++++++++++++++++
.../src/main/resources/microservice.yaml | 11 +++
edge-service/src/main/resources/log4j2.xml | 43 ------------
edge-service/src/main/resources/logback.xml | 79 ++++++++++++++++++++++
edge-service/src/main/resources/microservice.yaml | 11 +++
integration-tests/src/main/resources/log4j2.xml | 43 ------------
integration-tests/src/main/resources/logback.xml | 79 ++++++++++++++++++++++
.../src/main/resources/microservice.yaml | 11 +++
resource-server/src/main/resources/log4j2.xml | 43 ------------
resource-server/src/main/resources/logback.xml | 79 ++++++++++++++++++++++
.../src/main/resources/microservice.yaml | 11 +++
12 files changed, 360 insertions(+), 172 deletions(-)
diff --git a/authentication-server/src/main/resources/log4j2.xml b/authentication-server/src/main/resources/log4j2.xml
deleted file mode 100644
index 3c70391..0000000
--- a/authentication-server/src/main/resources/log4j2.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<!--this is sample configuration, please modify as your wish-->
-
-<configuration>
- <Properties>
- <Property name="log_path">./user/log/</Property>
- </Properties>
-
- <Appenders>
- <Console name="Console" target="SYSTEM_OUT">
- <PatternLayout pattern="[%d][%t][%p][%c:%L] %m%n"/>
- </Console>
- <RollingFile name="DailyRollingFile" fileName="${log_path}/output.log"
- filePattern="${log_path}/zcrTest%d{yyyy-MM-dd}.log">
- <PatternLayout pattern="[%d][%t][%p][%c:%L] %m%n"/>
- <TimeBasedTriggeringPolicy interval="1"/>
- <SizeBasedTriggeringPolicy size="10 MB"/>
- </RollingFile>
- </Appenders>
- <Loggers>
- <Root level="info">
- <AppenderRef ref="Console"/>
- <AppenderRef ref="DailyRollingFile"/>
- </Root>
- </Loggers>
-</configuration>
\ No newline at end of file
diff --git a/authentication-server/src/main/resources/logback.xml b/authentication-server/src/main/resources/logback.xml
new file mode 100644
index 0000000..c9afc7a
--- /dev/null
+++ b/authentication-server/src/main/resources/logback.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<!--this is sample configuration, please modify as your wish -->
+
+<configuration scan="true">
+
+ <property name="log.path" value="./authentication-server/log/"/>
+
+ <appender name="ROOT_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.path}/output.log</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <fileNamePattern>${log.path}/output%d{yyyy-MM-dd}.log</fileNamePattern>
+ <maxHistory>1</maxHistory>
+ <totalSizeCap>10MB</totalSizeCap>
+ </rollingPolicy>
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{80} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="METRICS" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.path}/metrics.log</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <fileNamePattern>${log.path}/metrics%d{yyyy-MM-dd}.log</fileNamePattern>
+ <maxHistory>1</maxHistory>
+ <totalSizeCap>10MB</totalSizeCap>
+ </rollingPolicy>
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{80} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="ACCESS" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.path}/access.log</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <fileNamePattern>${log.path}/access%d{yyyy-MM-dd}.log</fileNamePattern>
+ <maxHistory>1</maxHistory>
+ <totalSizeCap>10MB</totalSizeCap>
+ </rollingPolicy>
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{80} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{80} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <logger name="org.apache.servicecomb.metrics.core.publish.DefaultLogPublisher" level="INFO" additivity="false">
+ <appender-ref ref="METRICS"/>
+ </logger>
+ <logger name="accesslog" level="INFO" additivity="false">
+ <appender-ref ref="ACCESS" />
+ </logger>
+
+ <root level="INFO">
+ <appender-ref ref="STDOUT"/>
+ <appender-ref ref="ROOT_FILE"/>
+ </root>
+
+</configuration>
diff --git a/authentication-server/src/main/resources/microservice.yaml b/authentication-server/src/main/resources/microservice.yaml
index f6dc979..a46cddc 100644
--- a/authentication-server/src/main/resources/microservice.yaml
+++ b/authentication-server/src/main/resources/microservice.yaml
@@ -35,6 +35,17 @@ servicecomb:
rest:
address: 0.0.0.0:9061
+ accesslog:
+ ## server 端 启用access log
+ enabled: true
+ ## server 端 自定义 access log 日志格式
+ pattern: "%h %r %s %B %D"
+ request:
+ ## client 端开启 request log
+ enabled: true
+ ## client 端自定义 request log 日志格式
+ pattern: "%h %SCB-transport %r %s %D"
+
authentication:
token:
expiresIn: 600
diff --git a/edge-service/src/main/resources/log4j2.xml b/edge-service/src/main/resources/log4j2.xml
deleted file mode 100644
index b51f28e..0000000
--- a/edge-service/src/main/resources/log4j2.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<!--this is sample configuration, please modify as your wish-->
-
-<configuration>
- <Properties>
- <Property name="log_path">./gateway/log/</Property>
- </Properties>
-
- <Appenders>
- <Console name="Console" target="SYSTEM_OUT">
- <PatternLayout pattern="[%d][%t][%p][%c:%L] %m%n"/>
- </Console>
- <RollingFile name="DailyRollingFile" fileName="${log_path}/output.log"
- filePattern="${log_path}/zcrTest%d{yyyy-MM-dd}.log">
- <PatternLayout pattern="[%d][%t][%p][%c:%L] %m%n"/>
- <TimeBasedTriggeringPolicy interval="1"/>
- <SizeBasedTriggeringPolicy size="10 MB"/>
- </RollingFile>
- </Appenders>
- <Loggers>
- <Root level="info">
- <AppenderRef ref="Console"/>
- <AppenderRef ref="DailyRollingFile"/>
- </Root>
- </Loggers>
-</configuration>
\ No newline at end of file
diff --git a/edge-service/src/main/resources/logback.xml b/edge-service/src/main/resources/logback.xml
new file mode 100644
index 0000000..6847153
--- /dev/null
+++ b/edge-service/src/main/resources/logback.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<!--this is sample configuration, please modify as your wish -->
+
+<configuration scan="true">
+
+ <property name="log.path" value="./edge-service/log/"/>
+
+ <appender name="ROOT_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.path}/output.log</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <fileNamePattern>${log.path}/output%d{yyyy-MM-dd}.log</fileNamePattern>
+ <maxHistory>1</maxHistory>
+ <totalSizeCap>10MB</totalSizeCap>
+ </rollingPolicy>
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{80} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="METRICS" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.path}/metrics.log</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <fileNamePattern>${log.path}/metrics%d{yyyy-MM-dd}.log</fileNamePattern>
+ <maxHistory>1</maxHistory>
+ <totalSizeCap>10MB</totalSizeCap>
+ </rollingPolicy>
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{80} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="ACCESS" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.path}/access.log</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <fileNamePattern>${log.path}/access%d{yyyy-MM-dd}.log</fileNamePattern>
+ <maxHistory>1</maxHistory>
+ <totalSizeCap>10MB</totalSizeCap>
+ </rollingPolicy>
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{80} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{80} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <logger name="org.apache.servicecomb.metrics.core.publish.DefaultLogPublisher" level="INFO" additivity="false">
+ <appender-ref ref="METRICS"/>
+ </logger>
+ <logger name="accesslog" level="INFO" additivity="false">
+ <appender-ref ref="ACCESS" />
+ </logger>
+
+ <root level="INFO">
+ <appender-ref ref="STDOUT"/>
+ <appender-ref ref="ROOT_FILE"/>
+ </root>
+
+</configuration>
diff --git a/edge-service/src/main/resources/microservice.yaml b/edge-service/src/main/resources/microservice.yaml
index ba60751..9ea9ef8 100644
--- a/edge-service/src/main/resources/microservice.yaml
+++ b/edge-service/src/main/resources/microservice.yaml
@@ -43,6 +43,17 @@ servicecomb:
authentication-server: internalAccess,qps-flowcontrol-consumer,loadbalance
authentication-client: internalAccess,qps-flowcontrol-consumer,loadbalance
+ accesslog:
+ ## server 端 启用access log
+ enabled: true
+ ## server 端 自定义 access log 日志格式
+ pattern: "%h %r %s %B %D"
+ request:
+ ## client 端开启 request log
+ enabled: true
+ ## client 端自定义 request log 日志格式
+ pattern: "%h %SCB-transport %r %s %D"
+
http:
dispatcher:
edge:
diff --git a/integration-tests/src/main/resources/log4j2.xml b/integration-tests/src/main/resources/log4j2.xml
deleted file mode 100644
index 21d465b..0000000
--- a/integration-tests/src/main/resources/log4j2.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<!--this is sample configuration, please modify as your wish-->
-
-<configuration>
- <Properties>
- <Property name="log_path">./user/log/</Property>
- </Properties>
-
- <Appenders>
- <Console name="Console" target="SYSTEM_OUT">
- <PatternLayout pattern="[%d][%t][%p][%c:%L] %m%n"/>
- </Console>
- <RollingFile name="DailyRollingFile" fileName="${log_path}/output.log"
- filePattern="${log_path}/zcrTest%d{yyyy-MM-dd}.log">
- <PatternLayout pattern="[%d][%t][%p][%c:%L] %m%n"/>
- <TimeBasedTriggeringPolicy interval="1"/>
- <SizeBasedTriggeringPolicy size="10 MB"/>
- </RollingFile>
- </Appenders>
- <Loggers>
- <Root level="info">
- <AppenderRef ref="Console"/>
- <AppenderRef ref="DailyRollingFile"/>
- </Root>
- </Loggers>
-</configuration>
diff --git a/integration-tests/src/main/resources/logback.xml b/integration-tests/src/main/resources/logback.xml
new file mode 100644
index 0000000..4000d50
--- /dev/null
+++ b/integration-tests/src/main/resources/logback.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<!--this is sample configuration, please modify as your wish -->
+
+<configuration scan="true">
+
+ <property name="log.path" value="./integration-tests/log/"/>
+
+ <appender name="ROOT_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.path}/output.log</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <fileNamePattern>${log.path}/output%d{yyyy-MM-dd}.log</fileNamePattern>
+ <maxHistory>1</maxHistory>
+ <totalSizeCap>10MB</totalSizeCap>
+ </rollingPolicy>
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{80} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="METRICS" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.path}/metrics.log</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <fileNamePattern>${log.path}/metrics%d{yyyy-MM-dd}.log</fileNamePattern>
+ <maxHistory>1</maxHistory>
+ <totalSizeCap>10MB</totalSizeCap>
+ </rollingPolicy>
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{80} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="ACCESS" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.path}/access.log</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <fileNamePattern>${log.path}/access%d{yyyy-MM-dd}.log</fileNamePattern>
+ <maxHistory>1</maxHistory>
+ <totalSizeCap>10MB</totalSizeCap>
+ </rollingPolicy>
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{80} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{80} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <logger name="org.apache.servicecomb.metrics.core.publish.DefaultLogPublisher" level="INFO" additivity="false">
+ <appender-ref ref="METRICS"/>
+ </logger>
+ <logger name="accesslog" level="INFO" additivity="false">
+ <appender-ref ref="ACCESS" />
+ </logger>
+
+ <root level="INFO">
+ <appender-ref ref="STDOUT"/>
+ <appender-ref ref="ROOT_FILE"/>
+ </root>
+
+</configuration>
diff --git a/integration-tests/src/main/resources/microservice.yaml b/integration-tests/src/main/resources/microservice.yaml
index f19ca7b..8f7ef7f 100644
--- a/integration-tests/src/main/resources/microservice.yaml
+++ b/integration-tests/src/main/resources/microservice.yaml
@@ -34,3 +34,14 @@ servicecomb:
rest:
address: 0.0.0.0:9093
+
+ accesslog:
+ ## server 端 启用access log
+ enabled: true
+ ## server 端 自定义 access log 日志格式
+ pattern: "%h %r %s %B %D"
+ request:
+ ## client 端开启 request log
+ enabled: true
+ ## client 端自定义 request log 日志格式
+ pattern: "%h %SCB-transport %r %s %D"
diff --git a/resource-server/src/main/resources/log4j2.xml b/resource-server/src/main/resources/log4j2.xml
deleted file mode 100644
index 3c70391..0000000
--- a/resource-server/src/main/resources/log4j2.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ~ Licensed to the Apache Software Foundation (ASF) under one or more
- ~ contributor license agreements. See the NOTICE file distributed with
- ~ this work for additional information regarding copyright ownership.
- ~ The ASF licenses this file to You under the Apache License, Version 2.0
- ~ (the "License"); you may not use this file except in compliance with
- ~ the License. You may obtain a copy of the License at
- ~
- ~ http://www.apache.org/licenses/LICENSE-2.0
- ~
- ~ Unless required by applicable law or agreed to in writing, software
- ~ distributed under the License is distributed on an "AS IS" BASIS,
- ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- ~ See the License for the specific language governing permissions and
- ~ limitations under the License.
- -->
-
-<!--this is sample configuration, please modify as your wish-->
-
-<configuration>
- <Properties>
- <Property name="log_path">./user/log/</Property>
- </Properties>
-
- <Appenders>
- <Console name="Console" target="SYSTEM_OUT">
- <PatternLayout pattern="[%d][%t][%p][%c:%L] %m%n"/>
- </Console>
- <RollingFile name="DailyRollingFile" fileName="${log_path}/output.log"
- filePattern="${log_path}/zcrTest%d{yyyy-MM-dd}.log">
- <PatternLayout pattern="[%d][%t][%p][%c:%L] %m%n"/>
- <TimeBasedTriggeringPolicy interval="1"/>
- <SizeBasedTriggeringPolicy size="10 MB"/>
- </RollingFile>
- </Appenders>
- <Loggers>
- <Root level="info">
- <AppenderRef ref="Console"/>
- <AppenderRef ref="DailyRollingFile"/>
- </Root>
- </Loggers>
-</configuration>
\ No newline at end of file
diff --git a/resource-server/src/main/resources/logback.xml b/resource-server/src/main/resources/logback.xml
new file mode 100644
index 0000000..26b9c69
--- /dev/null
+++ b/resource-server/src/main/resources/logback.xml
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<!--this is sample configuration, please modify as your wish -->
+
+<configuration scan="true">
+
+ <property name="log.path" value="./resource-server/log/"/>
+
+ <appender name="ROOT_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.path}/output.log</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <fileNamePattern>${log.path}/output%d{yyyy-MM-dd}.log</fileNamePattern>
+ <maxHistory>1</maxHistory>
+ <totalSizeCap>10MB</totalSizeCap>
+ </rollingPolicy>
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{80} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="METRICS" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.path}/metrics.log</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <fileNamePattern>${log.path}/metrics%d{yyyy-MM-dd}.log</fileNamePattern>
+ <maxHistory>1</maxHistory>
+ <totalSizeCap>10MB</totalSizeCap>
+ </rollingPolicy>
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{80} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="ACCESS" class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${log.path}/access.log</file>
+ <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+ <fileNamePattern>${log.path}/access%d{yyyy-MM-dd}.log</fileNamePattern>
+ <maxHistory>1</maxHistory>
+ <totalSizeCap>10MB</totalSizeCap>
+ </rollingPolicy>
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{80} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
+ <encoder>
+ <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{80} - %msg%n</pattern>
+ </encoder>
+ </appender>
+
+ <logger name="org.apache.servicecomb.metrics.core.publish.DefaultLogPublisher" level="INFO" additivity="false">
+ <appender-ref ref="METRICS"/>
+ </logger>
+ <logger name="accesslog" level="INFO" additivity="false">
+ <appender-ref ref="ACCESS" />
+ </logger>
+
+ <root level="INFO">
+ <appender-ref ref="STDOUT"/>
+ <appender-ref ref="ROOT_FILE"/>
+ </root>
+
+</configuration>
diff --git a/resource-server/src/main/resources/microservice.yaml b/resource-server/src/main/resources/microservice.yaml
index 05abf87..58ba765 100644
--- a/resource-server/src/main/resources/microservice.yaml
+++ b/resource-server/src/main/resources/microservice.yaml
@@ -35,6 +35,17 @@ servicecomb:
rest:
address: 0.0.0.0:9092
+ accesslog:
+ ## server 端 启用access log
+ enabled: true
+ ## server 端 自定义 access log 日志格式
+ pattern: "%h %r %s %B %D"
+ request:
+ ## client 端开启 request log
+ enabled: true
+ ## client 端自定义 request log 日志格式
+ pattern: "%h %SCB-transport %r %s %D"
+
authencation:
access:
needAuth: true