Skip to content

Commit

Permalink
1. change charset to UTF-8(replace GBK or utf8)
Browse files Browse the repository at this point in the history
2. support custom nacos server logs path in application* profile(key:nacos.logs.path)
  • Loading branch information
anjia0532 committed Dec 9, 2018
1 parent 7916583 commit 0c5654c
Show file tree
Hide file tree
Showing 5 changed files with 189 additions and 175 deletions.
74 changes: 38 additions & 36 deletions config/src/main/resources/META-INF/logback/nacos-included.xml
Original file line number Diff line number Diff line change
@@ -1,202 +1,204 @@
<?xml version="1.0" encoding="UTF-8"?>
<included>
<springProperty scope="context" name="logPath" source="nacos.logs.path" defaultValue="${user.home}/nacos/logs"/>
<property name="LOG_HOME" value="${logPath}"/>
<appender name="dumpFile"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${user.home}/nacos/logs/config-dump.log</file>
<file>${LOG_HOME}/config-dump.log</file>
<append>true</append>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${user.home}/nacos/logs/config-dump.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
<fileNamePattern>${LOG_HOME}/config-dump.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
<maxFileSize>2GB</maxFileSize>
<MaxHistory>15</MaxHistory>
<totalSizeCap>7GB</totalSizeCap>
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder>
<Pattern>%date %level %msg%n%n</Pattern>
<charset>GBK</charset>
<charset>UTF-8</charset>
</encoder>
</appender>
<appender name="pullFile"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${user.home}/nacos/logs/config-pull.log</file>
<file>${LOG_HOME}/config-pull.log</file>
<append>true</append>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${user.home}/nacos/logs/config-pull.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
<fileNamePattern>${LOG_HOME}/config-pull.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
<maxFileSize>20MB</maxFileSize>
<MaxHistory>15</MaxHistory>
<totalSizeCap>128MB</totalSizeCap>
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder>
<Pattern>%date %level %msg%n%n</Pattern>
<charset>GBK</charset>
<charset>UTF-8</charset>
</encoder>
</appender>
<appender name="fatalFile"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${user.home}/nacos/logs/config-fatal.log</file>
<file>${LOG_HOME}/config-fatal.log</file>
<append>true</append>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${user.home}/nacos/logs/config-fatal.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
<fileNamePattern>${LOG_HOME}/config-fatal.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
<maxFileSize>20MB</maxFileSize>
<MaxHistory>15</MaxHistory>
<totalSizeCap>128MB</totalSizeCap>
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder>
<Pattern>%date %level %msg%n%n</Pattern>
<charset>GBK</charset>
<charset>UTF-8</charset>
</encoder>
</appender>
<appender name="memoryFile"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${user.home}/nacos/logs/config-memory.log</file>
<file>${LOG_HOME}/config-memory.log</file>
<append>true</append>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${user.home}/nacos/logs/config-memory.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
<fileNamePattern>${LOG_HOME}/config-memory.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
<maxFileSize>20MB</maxFileSize>
<MaxHistory>15</MaxHistory>
<totalSizeCap>128MB</totalSizeCap>
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder>
<Pattern>%date %level %msg%n%n</Pattern>
<charset>GBK</charset>
<charset>UTF-8</charset>
</encoder>
</appender>
<appender name="pullCheckFile"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${user.home}/nacos/logs/config-pull-check.log</file>
<file>${LOG_HOME}/config-pull-check.log</file>
<append>true</append>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${user.home}/nacos/logs/config-pull-check.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
<fileNamePattern>${LOG_HOME}/config-pull-check.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
<maxFileSize>1GB</maxFileSize>
<MaxHistory>15</MaxHistory>
<totalSizeCap>3GB</totalSizeCap>
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder>
<Pattern>%msg%n</Pattern>
<charset>GBK</charset>
<charset>UTF-8</charset>
</encoder>
</appender>

<appender name="aclLog"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${user.home}/nacos/logs/config-acl.log</file>
<file>${LOG_HOME}/config-acl.log</file>
<append>true</append>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${user.home}/nacos/logs/config-acl.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
<fileNamePattern>${LOG_HOME}/config-acl.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<MaxHistory>15</MaxHistory>
<totalSizeCap>512MB</totalSizeCap>
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder>
<Pattern>%date %level %msg%n%n</Pattern>
<charset>GBK</charset>
<charset>UTF-8</charset>
</encoder>
</appender>

<appender name="clientLog"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${user.home}/nacos/logs/config-client-request.log</file>
<file>${LOG_HOME}/config-client-request.log</file>
<append>true</append>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${user.home}/nacos/logs/config-client-request.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
<fileNamePattern>${LOG_HOME}/config-client-request.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
<maxFileSize>2GB</maxFileSize>
<MaxHistory>15</MaxHistory>
<totalSizeCap>7GB</totalSizeCap>
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder>
<Pattern>%date|%msg%n</Pattern>
<charset>GBK</charset>
<charset>UTF-8</charset>
</encoder>
</appender>

<appender name="sdkLog"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${user.home}/nacos/logs/config-sdk-request.log</file>
<file>${LOG_HOME}/config-sdk-request.log</file>
<append>true</append>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${user.home}/nacos/logs/config-sdk-request.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
<fileNamePattern>${LOG_HOME}/config-sdk-request.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
<maxFileSize>1GB</maxFileSize>
<MaxHistory>15</MaxHistory>
<totalSizeCap>3GB</totalSizeCap>
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder>
<Pattern>%date|%msg%n</Pattern>
<charset>GBK</charset>
<charset>UTF-8</charset>
</encoder>
</appender>

<appender name="traceLog"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${user.home}/nacos/logs/config-trace.log</file>
<file>${LOG_HOME}/config-trace.log</file>
<append>true</append>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${user.home}/nacos/logs/config-trace.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
<fileNamePattern>${LOG_HOME}/config-trace.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
<maxFileSize>2GB</maxFileSize>
<MaxHistory>15</MaxHistory>
<totalSizeCap>7GB</totalSizeCap>
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder>
<Pattern>%date|%msg%n</Pattern>
<charset>GBK</charset>
<charset>UTF-8</charset>
</encoder>
</appender>

<appender name="notifyLog"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${user.home}/nacos/logs/config-notify.log</file>
<file>${LOG_HOME}/config-notify.log</file>
<append>true</append>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${user.home}/nacos/logs/config-notify.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
<fileNamePattern>${LOG_HOME}/config-notify.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
<maxFileSize>1GB</maxFileSize>
<MaxHistory>15</MaxHistory>
<totalSizeCap>3GB</totalSizeCap>
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder>
<Pattern>%date %level %msg%n%n</Pattern>
<charset>GBK</charset>
<charset>UTF-8</charset>
</encoder>
</appender>

<appender name="appCollectorLog"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${user.home}/nacos/logs/config-app.log</file>
<file>${LOG_HOME}/config-app.log</file>
<append>true</append>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${user.home}/nacos/logs/config-app.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
<fileNamePattern>${LOG_HOME}/config-app.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
<maxFileSize>20MB</maxFileSize>
<MaxHistory>15</MaxHistory>
<totalSizeCap>128MB</totalSizeCap>
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder>
<Pattern>%date %level %msg%n%n</Pattern>
<charset>GBK</charset>
<charset>UTF-8</charset>
</encoder>
</appender>

<appender name="startLog"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${user.home}/nacos/logs/config-server.log</file>
<file>${LOG_HOME}/config-server.log</file>
<append>true</append>
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${user.home}/nacos/logs/config-server.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
<fileNamePattern>${LOG_HOME}/config-server.log.%d{yyyy-MM-dd}.%i</fileNamePattern>
<maxFileSize>50MB</maxFileSize>
<MaxHistory>15</MaxHistory>
<totalSizeCap>512MB</totalSizeCap>
<cleanHistoryOnStart>true</cleanHistoryOnStart>
</rollingPolicy>
<encoder>
<Pattern>%date %level %msg%n%n</Pattern>
<charset>GBK</charset>
<charset>UTF-8</charset>
</encoder>
</appender>

Expand Down
Loading

0 comments on commit 0c5654c

Please sign in to comment.