Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
youjj
cloud-platform
Commits
7df6b31d
Commit
7df6b31d
authored
Jul 25, 2019
by
jiaorz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
注册积分队列
parent
e81f72a1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
100 additions
and
35 deletions
+100
-35
logback.xml
...versal/xx-universal-server/src/main/resources/logback.xml
+100
-35
No files found.
xx-universal/xx-universal-server/src/main/resources/logback.xml
View file @
7df6b31d
<?xml version="1.0" encoding="UTF-8"?>
<configuration
debug=
"false"
scan=
"true"
scanPeriod=
"10 seconds"
>
<configuration
debug=
"false"
>
<!--<include resource="org/springframework/boot/logging/logback/base.xml"/>-->
<!--定义日志文件的存储地址 勿在 LogBack 的配置中使用相对路径 -->
<!--<include resource="org/springframework/boot/logging/logback/console-appender.xml"/>-->
<property
name=
"LOG_HOME"
value=
"${system.log.path:-logs}"
/>
<contextName>
logback
</contextName>
<!-- 彩色日志依赖的渲染类 -->
<conversionRule
conversionWord=
"clr"
converterClass=
"org.springframework.boot.logging.logback.ColorConverter"
/>
<!--输出sql语句-->
<conversionRule
conversionWord=
"wex"
converterClass=
"org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"
/>
<logger
name=
"com.xxfc"
level=
"debug"
/>
<conversionRule
conversionWord=
"wEx"
converterClass=
"org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"
/>
<property
name=
"path"
value=
"logs"
></property>
<!-- 彩色日志格式 -->
<property
name=
"maxHistory"
value=
"30"
/>
<property
name=
"CONSOLE_LOG_PATTERN"
value=
"${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"
/>
<property
name=
"maxFileSize"
value=
"50MB"
/>
<appender
name=
"STDOUT"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<!--1. 输出到控制台-->
<appender
name=
"console"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<filter
class=
"ch.qos.logback.classic.filter.ThresholdFilter"
>
<level>
debug
</level>
</filter>
<encoder>
<encoder>
<
Pattern>
${CONSOLE_LOG_PATTERN}
</Pattern>
<
pattern>
%date %level [%thread] %logger{36} [%file : %line] %msg%n
<
charset>
UTF-8
</charset>
<!-- 设置字符集 --
>
<
/pattern
>
</encoder>
</encoder>
</appender>
</appender>
<appender
name=
"
SYSTEM_FILE"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<!-- 按照每天生成日志文件 --
>
<appender
name=
"
debug_file"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<fil
ter
class=
"com.xxfc.platform.universal.filter.DenyFilter"
></filter
>
<fil
e>
${path}/logback_debug.log
</file
>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<FileNamePattern>
${LOG_HOME}/sys.%d{yyyy-MM-dd}.log
</FileNamePattern>
<!--日志文件输出的文件名 -->
<!-- 每天一归档 -->
<MaxHistory>
30
</MaxHistory>
<!--日志文件保留天数 -->
<fileNamePattern>
${path}/logback_debug.log.%d{yyyy-MM-dd}-%i.zip
</fileNamePattern>
<maxHistory>
${maxHistory}
</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"
>
<maxFileSize>
${maxFileSize}
</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
</rollingPolicy>
<encoder
class=
"ch.qos.logback.classic.encoder.PatternLayoutEncoder"
>
<encoder>
<pattern>
%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{50} - %msg%n
</pattern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<pattern>
%date %level [%thread] %logger{36} [%file : %line] %msg%n
</pattern>
</encoder>
</encoder>
<filter
class=
"ch.qos.logback.classic.filter.LevelFilter"
>
<level>
DEBUG
</level>
<onMatch>
ACCEPT
</onMatch>
<onMismatch>
DENY
</onMismatch>
</filter>
</appender>
</appender>
<appender
name=
"
WEB_FILE"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<!-- 按照每天生成日志文件 --
>
<appender
name=
"
info_file"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<fil
ter
class=
"com.xxfc.platform.universal.filter.AcceptFilter"
></filter
>
<fil
e>
${path}/logback_info.log
</file
>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<FileNamePattern>
${LOG_HOME}/log.%d{yyyy-MM-dd}.log
</FileNamePattern>
<!--日志文件输出的文件名 -->
<!-- 每天一归档 -->
<MaxHistory>
30
</MaxHistory>
<!--日志文件保留天数 -->
<fileNamePattern>
${path}/logback_info.log.%d{yyyy-MM-dd}-%i.zip
</fileNamePattern>
<maxHistory>
${maxHistory}
</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"
>
<maxFileSize>
${maxFileSize}
</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
</rollingPolicy>
<encoder
class=
"ch.qos.logback.classic.encoder.PatternLayoutEncoder"
>
<encoder>
<pattern>
%d{yyyy-MM-dd HH:mm:ss} [%thread] %-5level %logger{50} - %msg%n
</pattern>
<!--格式化输出:%d表示日期,%thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%n是换行符 -->
<pattern>
%date %level [%thread] %logger{36} [%file : %line] %msg%n
</pattern>
</encoder>
</encoder>
<filter
class=
"ch.qos.logback.classic.filter.LevelFilter"
>
<level>
INFO
</level>
<onMatch>
ACCEPT
</onMatch>
<onMismatch>
DENY
</onMismatch>
</filter>
</appender>
</appender>
<appender
name=
"LOGSTASH"
class=
"net.logstash.logback.appender.LogstashTcpSocketAppender"
>
<appender
name=
"warn_file"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<destination>
192.168.0.181:5044
</destination>
<file>
${path}/logback_warn.log
</file>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<!-- 每天一归档 -->
<fileNamePattern>
${path}/logback_warn.log.%d{yyyy-MM-dd}-%i.zip
</fileNamePattern>
<maxHistory>
${maxHistory}
</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"
>
<maxFileSize>
${maxFileSize}
</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%date %level [%thread] %logger{36} [%file : %line] %msg%n
</pattern>
</encoder>
<filter
class=
"ch.qos.logback.classic.filter.LevelFilter"
>
<level>
WARN
</level>
<onMatch>
ACCEPT
</onMatch>
<onMismatch>
DENY
</onMismatch>
</filter>
</appender>
<encoder
charset=
"UTF-8"
class=
"net.logstash.logback.encoder.LogstashEncoder"
>
<!--"appname":"springboot21-log-elk" 的作用是指定创建索引的名字时用,并且在生成的文档中会多了这个字段
在logstashindex中引入 index => "%{[appname]}-%{+YYYY.MM.dd}"-->
<customFields>
{"appName":"elk-log-service-operate-dev"}
</customFields>
<appender
name=
"error_file"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<file>
${path}/logback_error.log
</file>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<!-- 每天一归档 -->
<fileNamePattern>
${path}/logback_error.log.%d{yyyy-MM-dd}-%i.zip
</fileNamePattern>
<maxHistory>
${maxHistory}
</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"
>
<maxFileSize>
${maxFileSize}
</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
<encoder>
<pattern>
%date %level [%thread] %logger{36} [%file : %line] %msg%n
</pattern>
</encoder>
</encoder>
<filter
class=
"ch.qos.logback.classic.filter.LevelFilter"
>
<level>
ERROR
</level>
<onMatch>
ACCEPT
</onMatch>
<onMismatch>
DENY
</onMismatch>
</filter>
</appender>
</appender>
<root
level=
"INFO"
>
<root>
<appender-ref
ref=
"STDOUT"
/>
<level
value=
"info"
/>
<appender-ref
ref=
"console"
/>
<appender-ref
ref=
"debug_file"
/>
<appender-ref
ref=
"info_file"
/>
<appender-ref
ref=
"warn_file"
/>
<appender-ref
ref=
"error_file"
/>
</root>
</root>
</configuration>
</configuration>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment