Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
cfld-region-outline
Project
Project
Details
Activity
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
cfld-backend
cfld-region-outline
Commits
83a7a119
Commit
83a7a119
authored
Dec 15, 2023
by
yaobaizheng
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
配置日志文件
parent
bde3ad19
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
149 additions
and
4 deletions
+149
-4
application-dev.yml
src/main/resources/application-dev.yml
+6
-0
application-prod.yml
src/main/resources/application-prod.yml
+4
-0
application-test.yml
src/main/resources/application-test.yml
+4
-0
application.yml
src/main/resources/application.yml
+1
-4
logback-spring.xml
src/main/resources/mapper/logback-spring.xml
+134
-0
No files found.
src/main/resources/application-dev.yml
View file @
83a7a119
...
...
@@ -77,3 +77,8 @@ huaweiObs:
business
:
url
:
thread
:
localhost:8087/lyy/api/threadInfo/v1.0/save
mybatis-plus
:
configuration
:
# 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
log-impl
:
org.apache.ibatis.logging.stdout.StdOutImpl
\ No newline at end of file
src/main/resources/application-prod.yml
View file @
83a7a119
...
...
@@ -80,3 +80,6 @@ swagger:
business
:
url
:
thread
:
localhost:8087/lyy/api/threadInfo/v1.0/save
mybatis-plus
:
configuration
:
log-impl
:
org.apache.ibatis.logging.slf4j.Slf4jImpl
\ No newline at end of file
src/main/resources/application-test.yml
View file @
83a7a119
...
...
@@ -77,3 +77,6 @@ huaweiObs:
business
:
url
:
thread
:
localhost:8087/lyy/api/threadInfo/v1.0/save
mybatis-plus
:
configuration
:
log-impl
:
org.apache.ibatis.logging.slf4j.Slf4jImpl
\ No newline at end of file
src/main/resources/application.yml
View file @
83a7a119
...
...
@@ -19,7 +19,7 @@ server:
logging
:
level
:
com.lyy
:
debug
org.springframework
:
warn
org.springframework
:
info
spring
:
application
:
...
...
@@ -58,8 +58,6 @@ mybatis-plus:
map-underscore-to-camel-case
:
true
# 是否开启二级缓存。
cache-enabled
:
false
# 这个配置会将执行的sql打印出来,在开发或测试的时候可以用
log-impl
:
org.apache.ibatis.logging.stdout.StdOutImpl
# 指定实体类的包路径,用于自动扫描并注册类型别名。
type-aliases-package
:
com.lyy.**.domain,com.lyy.**.VO
#处理自增id异常
...
...
@@ -104,4 +102,3 @@ liyeren:
whiteIp
:
120.46.86.157
#立业人加密密钥
key
:
a5gcCE1MV4j2W9x7
src/main/resources/mapper/logback-spring.xml
0 → 100644
View file @
83a7a119
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<property
name=
"projectName"
value=
"cfld-region-outline"
/>
<springProperty
scope=
"context"
name=
"moduleName"
source=
"spring.application.name"
defaultValue=
"cfld-region-outline"
/>
<springProperty
scope=
"context"
name=
"logNum"
source=
"log.num"
defaultValue=
"01"
/>
<springProfile
name=
"test"
>
<property
name=
"logPathPrefix"
value=
"/app/logs"
/>
</springProfile>
<springProfile
name=
"pro"
>
<property
name=
"logPathPrefix"
value=
"/app/logs"
/>
</springProfile>
<property
name=
"logger.path"
value=
"${logPathPrefix}/${projectName}"
/>
<property
name=
"maxHistory"
value=
"30"
/>
<property
name=
"maxFileSize"
value=
"50MB"
/>
<property
name=
"CONSOLE_LOG_PATTERN"
value=
"${CONSOLE_LOG_PATTERN:-%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}}"
/>
<conversionRule
conversionWord=
"clr"
converterClass=
"org.springframework.boot.logging.logback.ColorConverter"
/>
<conversionRule
conversionWord=
"wex"
converterClass=
"org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"
/>
<conversionRule
conversionWord=
"wEx"
converterClass=
"org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"
/>
<appender
name=
"CONSOLE"
class=
"ch.qos.logback.core.ConsoleAppender"
>
<encoder>
<pattern>
${CONSOLE_LOG_PATTERN}
</pattern>
<charset>
utf8
</charset>
</encoder>
</appender>
<appender
name=
"DEBUG_FILE"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<file>
${logger.path}/debug/${moduleName}-${logNum}-debug.log
</file>
<encoder>
<pattern>
%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n
</pattern>
<charset>
UTF-8
</charset>
</encoder>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<fileNamePattern>
${logger.path}/debug/${moduleName}-${logNum}-debug-%d{yyyy-MM-dd}.%i.zip
</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"
>
<maxFileSize>
${maxFileSize}
</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>
${maxHistory}
</maxHistory>
</rollingPolicy>
<filter
class=
"ch.qos.logback.classic.filter.LevelFilter"
>
<level>
debug
</level>
<onMatch>
ACCEPT
</onMatch>
<onMismatch>
DENY
</onMismatch>
</filter>
</appender>
<appender
name=
"INFO_FILE"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<file>
${logger.path}/info/${moduleName}-${logNum}-info.log
</file>
<encoder>
<pattern>
%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n
</pattern>
<charset>
UTF-8
</charset>
</encoder>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<fileNamePattern>
${logger.path}/info/${moduleName}-${logNum}-info-%d{yyyy-MM-dd}.%i.zip
</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"
>
<maxFileSize>
${maxFileSize}
</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>
${maxHistory}
</maxHistory>
</rollingPolicy>
<filter
class=
"ch.qos.logback.classic.filter.LevelFilter"
>
<level>
info
</level>
<onMatch>
ACCEPT
</onMatch>
<onMismatch>
DENY
</onMismatch>
</filter>
</appender>
<appender
name=
"WARN_FILE"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<file>
${logger.path}/warn/${moduleName}-${logNum}-warn.log
</file>
<encoder>
<pattern>
%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n
</pattern>
<charset>
UTF-8
</charset>
</encoder>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<fileNamePattern>
${logger.path}/warn/${moduleName}-${logNum}-warn-%d{yyyy-MM-dd}.%i.zip
</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"
>
<maxFileSize>
${maxFileSize}
</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>
${maxHistory}
</maxHistory>
</rollingPolicy>
<filter
class=
"ch.qos.logback.classic.filter.LevelFilter"
>
<level>
warn
</level>
<onMatch>
ACCEPT
</onMatch>
<onMismatch>
DENY
</onMismatch>
</filter>
</appender>
<appender
name=
"ERROR_FILE"
class=
"ch.qos.logback.core.rolling.RollingFileAppender"
>
<file>
${logger.path}/error/${moduleName}-${logNum}-error.log
</file>
<encoder>
<pattern>
%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n
</pattern>
<charset>
UTF-8
</charset>
</encoder>
<rollingPolicy
class=
"ch.qos.logback.core.rolling.TimeBasedRollingPolicy"
>
<fileNamePattern>
${logger.path}/error/${moduleName}-${logNum}-error-%d{yyyy-MM-dd}.%i.zip
</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class=
"ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"
>
<maxFileSize>
${maxFileSize}
</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>
${maxHistory}
</maxHistory>
</rollingPolicy>
<filter
class=
"ch.qos.logback.classic.filter.LevelFilter"
>
<level>
ERROR
</level>
<onMatch>
ACCEPT
</onMatch>
<onMismatch>
DENY
</onMismatch>
</filter>
</appender>
<!--dev环境 info界别 输出到控制台-->
<springProfile
name=
"dev"
>
<root
level=
"info"
>
<appender-ref
ref=
"CONSOLE"
/>
</root>
</springProfile>
<!--test环境 info界别 输出到三个日志文件中-->
<springProfile
name=
"test"
>
<root
level=
"info"
>
<appender-ref
ref=
"INFO_FILE"
/>
<appender-ref
ref=
"DEBUG_FILE"
/>
<appender-ref
ref=
"ERROR_FILE"
/>
</root>
</springProfile>
<springProfile
name=
"pro"
>
<root
level=
"info"
>
<appender-ref
ref=
"INFO_FILE"
/>
<appender-ref
ref=
"DEBUG_FILE"
/>
<appender-ref
ref=
"ERROR_FILE"
/>
</root>
</springProfile>
</configuration>
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