Add settings to enable logging services
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -35,3 +35,6 @@ out/
|
|||||||
|
|
||||||
### VS Code ###
|
### VS Code ###
|
||||||
.vscode/
|
.vscode/
|
||||||
|
|
||||||
|
/logs
|
||||||
|
/logs/*.log
|
||||||
|
|||||||
@@ -19,6 +19,9 @@ configurations {
|
|||||||
compileOnly {
|
compileOnly {
|
||||||
extendsFrom annotationProcessor
|
extendsFrom annotationProcessor
|
||||||
}
|
}
|
||||||
|
all {
|
||||||
|
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
@@ -41,6 +44,8 @@ dependencies {
|
|||||||
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.0'
|
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.0'
|
||||||
runtimeOnly 'com.h2database:h2'
|
runtimeOnly 'com.h2database:h2'
|
||||||
|
|
||||||
|
implementation 'com.lmax:disruptor:3.4.4'
|
||||||
|
implementation 'org.springframework.boot:spring-boot-starter-log4j2'
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-mail'
|
implementation 'org.springframework.boot:spring-boot-starter-mail'
|
||||||
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
|
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
|
||||||
implementation 'org.springframework.security:spring-security-crypto:5.5.2'
|
implementation 'org.springframework.security:spring-security-crypto:5.5.2'
|
||||||
|
|||||||
39
src/main/resources/log4j2.xml
Normal file
39
src/main/resources/log4j2.xml
Normal file
@@ -0,0 +1,39 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<Configuration status="WARN" monitorInterval="30">
|
||||||
|
<Properties>
|
||||||
|
<Property name="LOG_PATTERN">
|
||||||
|
%d{yyyy-MM-dd HH:mm:ss.SSS} %5p ${hostName} --- [%15.15t] %-40.40c{1.} : %m%n%ex
|
||||||
|
</Property>
|
||||||
|
</Properties>
|
||||||
|
<Appenders>
|
||||||
|
<Console name="ConsoleAppender" target="SYSTEM_OUT" follow="true">
|
||||||
|
<PatternLayout pattern="${LOG_PATTERN}"/>
|
||||||
|
</Console>
|
||||||
|
|
||||||
|
<!-- Rolling File Appender -->
|
||||||
|
<RollingFile name="FileAppender" fileName="logs/app.log"
|
||||||
|
filePattern="logs/app-%d{yyyy-MM-dd}-%i.log">
|
||||||
|
<PatternLayout>
|
||||||
|
<Pattern>${LOG_PATTERN}</Pattern>
|
||||||
|
</PatternLayout>
|
||||||
|
<Policies>
|
||||||
|
<TimeBasedTriggeringPolicy interval="1" />
|
||||||
|
<SizeBasedTriggeringPolicy size="10MB" />
|
||||||
|
</Policies>
|
||||||
|
<DefaultRolloverStrategy max="10"/>
|
||||||
|
</RollingFile>
|
||||||
|
</Appenders>
|
||||||
|
|
||||||
|
<Loggers>
|
||||||
|
<AsyncLogger name="com.yam.app" level="debug"
|
||||||
|
additivity="false">
|
||||||
|
<AppenderRef ref="ConsoleAppender" />
|
||||||
|
<AppenderRef ref="FileAppender" />
|
||||||
|
</AsyncLogger>
|
||||||
|
|
||||||
|
<Root level="info">
|
||||||
|
<AppenderRef ref="ConsoleAppender" />
|
||||||
|
<AppenderRef ref="FileAppender" />
|
||||||
|
</Root>
|
||||||
|
</Loggers>
|
||||||
|
</Configuration>
|
||||||
Reference in New Issue
Block a user