Skip to content

Commit

Permalink
Merge pull request #106 from zhangbin1010/dev
Browse files Browse the repository at this point in the history
[Upgrade] log-server 中对各服务的error日志进行单独存储
  • Loading branch information
zhangbinhub authored Oct 22, 2019
2 parents b85892e + 89ee82e commit cbe0306
Show file tree
Hide file tree
Showing 7 changed files with 81 additions and 37 deletions.
117 changes: 80 additions & 37 deletions cloud/log-server/src/main/resources/logback-spring.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
</pattern>
<charset>UTF8</charset>
</encoder>

<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_HOME}/%d{yyyy-MM-dd}/ALL.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
Expand All @@ -23,12 +22,32 @@
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>180</maxHistory>
</rollingPolicy>

<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>DEBUG</level>
</filter>
<!-- Safely log to the same file from multiple JVMs. Degrades performance! -->
<prudent>true</prudent>
</appender>
<appender name="ALL-ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
<encoder>
<pattern>
[%date{yyyy-MM-dd HH:mm:ss.SSS}] %msg%n
</pattern>
<charset>UTF8</charset>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_HOME}/%d{yyyy-MM-dd}/ALL.error.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>5 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>180</maxHistory>
</rollingPolicy>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>DEBUG</level>
</filter>
</appender>
<appender name="ALL-LOGSTASH" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<destination>127.0.0.1:9601</destination>
Expand All @@ -46,7 +65,6 @@
</pattern>
<charset>UTF8</charset>
</encoder>

<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_HOME}/%d{yyyy-MM-dd}/AUTH.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
Expand All @@ -56,52 +74,39 @@
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>180</maxHistory>
</rollingPolicy>

<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>DEBUG</level>
</filter>
<!-- Safely log to the same file from multiple JVMs. Degrades performance! -->
<prudent>true</prudent>
</appender>
<appender name="AUTH-LOGSTASH" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<destination>127.0.0.1:9601</destination>
<!-- encoder必须配置,有多种可选 -->
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder">
<!-- "appname":"log-server-ALL" 的作用是指定创建索引的名字时用,并且在生成的文档中会多了这个字段,必须小写 -->
<customFields>{"appname":"log_server_auth"}</customFields>
</encoder>
</appender>

<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<appender name="AUTH-ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
<encoder>
<pattern>
[%date{yyyy-MM-dd HH:mm:ss.SSS}] %msg%n
</pattern>
<charset>UTF8</charset>
</encoder>

<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_HOME}/%d{yyyy-MM-dd}/FILE.%i.log</fileNamePattern>
<fileNamePattern>${LOG_HOME}/%d{yyyy-MM-dd}/AUTH.error.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>5 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>180</maxHistory>
</rollingPolicy>

<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>DEBUG</level>
</filter>
<!-- Safely log to the same file from multiple JVMs. Degrades performance! -->
<prudent>true</prudent>
</appender>
<appender name="FILE-LOGSTASH" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<appender name="AUTH-LOGSTASH" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<destination>127.0.0.1:9601</destination>
<!-- encoder必须配置,有多种可选 -->
<encoder charset="UTF-8" class="net.logstash.logback.encoder.LogstashEncoder">
<!-- "appname":"log-server-ALL" 的作用是指定创建索引的名字时用,并且在生成的文档中会多了这个字段,必须小写 -->
<customFields>{"appname":"log_server_file"}</customFields>
<customFields>{"appname":"log_server_auth"}</customFields>
</encoder>
</appender>

Expand All @@ -112,7 +117,6 @@
</pattern>
<charset>UTF8</charset>
</encoder>

<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_HOME}/%d{yyyy-MM-dd}/ROUTE.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
Expand All @@ -122,12 +126,32 @@
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>180</maxHistory>
</rollingPolicy>

<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>DEBUG</level>
</filter>
<!-- Safely log to the same file from multiple JVMs. Degrades performance! -->
<prudent>true</prudent>
</appender>
<appender name="ROUTE-ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
<encoder>
<pattern>
[%date{yyyy-MM-dd HH:mm:ss.SSS}] %msg%n
</pattern>
<charset>UTF8</charset>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_HOME}/%d{yyyy-MM-dd}/ROUTE.error.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>5 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>180</maxHistory>
</rollingPolicy>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>DEBUG</level>
</filter>
</appender>
<appender name="ROUTE-LOGSTASH" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<destination>127.0.0.1:9601</destination>
Expand All @@ -145,7 +169,6 @@
</pattern>
<charset>UTF8</charset>
</encoder>

<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_HOME}/%d{yyyy-MM-dd}/WORKFLOW.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
Expand All @@ -155,12 +178,32 @@
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>180</maxHistory>
</rollingPolicy>

<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>DEBUG</level>
</filter>
<!-- Safely log to the same file from multiple JVMs. Degrades performance! -->
<prudent>true</prudent>
</appender>
<appender name="WORKFLOW-ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>ERROR</level>
</filter>
<encoder>
<pattern>
[%date{yyyy-MM-dd HH:mm:ss.SSS}] %msg%n
</pattern>
<charset>UTF8</charset>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_HOME}/%d{yyyy-MM-dd}/WORKFLOW.error.%i.log</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 64 MB -->
<maxFileSize>5 MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>180</maxHistory>
</rollingPolicy>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>DEBUG</level>
</filter>
</appender>
<appender name="WORKFLOW-LOGSTASH" class="net.logstash.logback.appender.LogstashTcpSocketAppender">
<destination>127.0.0.1:9601</destination>
Expand All @@ -173,22 +216,22 @@

<logger name="ALL" level="INFO" additivity="false">
<appender-ref ref="ALL"/>
<appender-ref ref="ALL-ERROR"/>
<appender-ref ref="ALL-LOGSTASH"/>
</logger>
<logger name="AUTH" level="INFO" additivity="false">
<appender-ref ref="AUTH"/>
<appender-ref ref="AUTH-ERROR"/>
<appender-ref ref="AUTH-LOGSTASH"/>
</logger>
<logger name="FILE" level="INFO" additivity="false">
<appender-ref ref="FILE"/>
<appender-ref ref="FILE-LOGSTASH"/>
</logger>
<logger name="ROUTE" level="INFO" additivity="false">
<appender-ref ref="ROUTE"/>
<appender-ref ref="ROUTE-ERROR"/>
<appender-ref ref="ROUTE-LOGSTASH"/>
</logger>
<logger name="WORKFLOW" level="INFO" additivity="false">
<appender-ref ref="WORKFLOW"/>
<appender-ref ref="WORKFLOW-ERROR"/>
<appender-ref ref="WORKFLOW-LOGSTASH"/>
</logger>
<jmxConfigurator/>
Expand Down
1 change: 1 addition & 0 deletions doc/version_history.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
> - [Upgrade] 升级核心库至 6.2.2
> - [Upgrade] 升级 gradle 至 5.6.3
> - [Upgrade] 规范文件绝对路径写法,使用canonicalPath
> - [Upgrade] log-server 中对各服务的error日志进行单独存储
##### v4.0.1
> - [Upgrade] 升级核心库至 6.2.1
> - [Upgrade] 升级 Spring Boot 至 2.1.9.RELEASE
Expand Down
Binary file modified libs/acp-client-6.2.2.jar
Binary file not shown.
Binary file modified libs/acp-core-6.2.2.jar
Binary file not shown.
Binary file modified libs/acp-packet-6.2.2.jar
Binary file not shown.
Binary file modified libs/acp-spring-boot-starter-6.2.2.jar
Binary file not shown.
Binary file modified libs/acp-spring-cloud-starter-6.2.2.jar
Binary file not shown.

0 comments on commit cbe0306

Please sign in to comment.