Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
yangxiujun
/
paidan_demo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit e1647731
authored
Nov 22, 2023
by
Ren Ping
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:日志输出
1 parent
ba0d26e5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
74 additions
and
0 deletions
project-user/src/main/resources/logback-spring.xml.bak
project-user/src/main/resources/logback-spring.xml.bak
0 → 100644
View file @
e164773
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<include
resource=
"org/springframework/boot/logging/logback/defaults.xml"
/>
<springProperty
scope=
"context"
name=
"springAppName"
source=
"spring.application.name"
/>
<!-- Example for logging into the build folder of your project -->
<property
name=
"LOG_FILE"
value=
"logs/${springAppName}"
/>
<!-- You can override this to have a custom pattern -->
<property
name=
"CONSOLE_LOG_PATTERN"
value=
"%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){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}"
/>
<!-- Appender to log to console -->
<appender
name=
"console"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<filter
class=
"ch.qos.logback.classic.filter.ThresholdFilter"
>
<!-- Minimum logging level to be presented in the console logs-->
<level>
DEBUG
</level>
</filter>
<encoder>
<pattern>
${CONSOLE_LOG_PATTERN}
</pattern>
<charset>
utf8
</charset>
</encoder>
</appender>
<!-- Appender to log to file -->
<appender
name=
"flatfile"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<file>
${LOG_FILE}
</file>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<fileNamePattern>
${LOG_FILE}.%d{yyyy-MM-dd}.gz
</fileNamePattern>
<maxHistory>
7
</maxHistory>
</rollingPolicy>
<encoder>
<pattern>
${CONSOLE_LOG_PATTERN}
</pattern>
<charset>
utf8
</charset>
</encoder>
</appender>
<!-- Appender to log to file in a JSON format
<appender name="logstash" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOG_FILE}.json</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_FILE}.json.%d{yyyy-MM-dd}.gz</fileNamePattern>
<maxHistory>7</maxHistory>
</rollingPolicy>
<encoder class="net.logstash.logback.encoder.LoggingEventCompositeJsonEncoder">
<providers>
<timestamp>
<timeZone>UTC</timeZone>
</timestamp>
<pattern>
<pattern>
{
"timestamp": "@timestamp",
"userId": "%X{userId:-}",
"severity": "%level",
"service": "${springAppName:-}",
"trace": "%X{traceId:-}",
"span": "%X{spanId:-}",
"pid": "${PID:-}",
"thread": "%thread",
"class": "%logger{40}",
"rest": "%message"
}
</pattern>
</pattern>
</providers>
</encoder>
</appender> -->
<root
level=
"INFO"
>
<appender-ref
ref=
"console"
/>
<!-- uncomment this to have also JSON logs -->
<!--<appender-ref ref="logstash"/>-->
<!--<appender-ref ref="flatfile"/>-->
</root>
</configuration>
\ No newline at end of file
Write
Preview
Markdown
is supported
Attach a file
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 post a comment