Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
secoo-log
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
mall
arch
secoo-log
Commits
3577793d
Commit
3577793d
authored
Jul 01, 2019
by
haozi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
readme
parent
7465e244
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
6 deletions
+66
-6
README.md
README.md
+62
-2
logback-spring.xml
secoo-log-starter/src/main/resources/logback-spring.xml
+4
-4
No files found.
README.md
View file @
3577793d
\ No newline at end of file
### secoo-log
+
封装logback.xml,日志标准格式
+
集成skywalking全链路监控tid打印
### spring boot配置
1.
删除log相关配置文件,如log4j.properties、logback.xml、logback-spring.xml等
2.
删除log相关POM依赖,如log4j、logback等
3.
添加依赖
```
<dependency>
<groupId>com.secoo.mall</groupId>
<artifactId>secoo-log-starter</artifactId>
<version>X.X.X</version>
</dependency>
```
4.
自定义参数
| 变量名 | 描述 | 缺省值 | 是否必填 |
| :------:| :------: | :------: |:------: |
|spring.application.name|应用名称|app|必填|
|log.level|等级|info|非必填|
|log.path|路径|/data/logs|非必填|
|log.max_file_size|切割大小|128MB|非必填|
|log.max_history|保留天数|7|非必填|
|log.pattern|输出格式(不建议修改)|-
|
%d{yyyy-MM-dd HH:mm:ss.SSS}
|
%-5level
|
%X{tid}
|
%thread
|
%logger{36}.%M:%L-%msg%n
`|非必填|
<!-- | 表示 | -->
### 非spring boot项目
1. 删除log相关配置文件,如log4j.properties、logback.xml、logback-spring.xml等
2. 删除log相关POM依赖,如log4j、logback等
3. 添加依赖
```
<dependency>
<groupId>com.secoo.mall</groupId>
<artifactId>secoo-log</artifactId>
<version>X.X.X</version>
</dependency>
```
4. 目录`
resources
`
添加log.properties配置文件,参数
| 变量名 | 描述 | 缺省值 | 是否必填 |
| :------:| :------: | :------: |:------: |
|logName|应用名称|无|必填|
|logLevel|等级|无|非必填|
### 版本
+
0.0.1${ver
\_
type}
注意:ver
\_
type后缀-DEV-SNAPSHOT、-SNAPSHOT、.RELEASE
\ No newline at end of file
secoo-log-starter/src/main/resources/logback-spring.xml
View file @
3577793d
...
...
@@ -3,12 +3,12 @@
<configuration
scan=
"true"
scanPeriod=
"60 seconds"
debug=
"false"
>
<springProperty
scope=
"context"
name=
"logName"
source=
"spring.application.name"
defaultValue=
"app"
/>
<springProperty
scope=
"context"
name=
"logLevel"
source=
"log.level"
defaultValue=
"info"
/>
<springProperty
scope=
"context"
name=
"LOG_PATH"
source=
"log.path"
defaultValue=
"/data/logs"
/>
<springProperty
scope=
"context"
name=
"MAX_FILE_SIZE"
source=
"log.max_file_size"
defaultValue=
"128MB"
/>
<springProperty
scope=
"context"
name=
"MAX_HISTORY"
source=
"log.max_history"
defaultValue=
"7"
/>
<springProperty
scope=
"context"
name=
"PATTERN"
source=
"log.pattern"
defaultValue=
"-|%d{yyyy-MM-dd HH:mm:ss.SSS}|%-5level|%X{tid}|%thread|%logger{36}.%M:%L-%msg%n"
/>
<property
name=
"LOG_PATH"
value=
"/data/logs"
/>
<property
name=
"LOG_DIR"
value=
"${LOG_PATH}/${logName}/%d{yyyyMMdd}"
/>
<property
name=
"MAX_FILE_SIZE"
value=
"128MB"
/>
<property
name=
"MAX_HISTORY"
value=
"7"
/>
<property
name=
"PATTERN"
value=
"-|%d{yyyy-MM-dd HH:mm:ss.SSS}|%-5level|%X{tid}|%thread|%logger{36}.%M:%L-%msg%n"
/>
<property
name=
"CHARSET"
value=
"UTF-8"
/>
<jmxConfigurator/>
...
...
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