feat: log4j2 설정

This commit is contained in:
dongHyo
2022-05-07 00:32:28 +09:00
parent b92f6e7a6f
commit 1dca969907
2 changed files with 48 additions and 1 deletions

View File

@@ -23,14 +23,23 @@ repositories {
mavenCentral()
}
dependencies {
implementation ("org.springframework.boot:spring-boot-starter-data-jpa")
// implementation ("org.springframework.boot:spring-boot-starter-security")
implementation ("org.springframework.boot:spring-boot-starter-validation")
implementation ("org.springframework.boot:spring-boot-starter-web")
implementation("org.springframework.boot:spring-boot-starter-actuator")
implementation ("com.github.ulisesbocchio:jasypt-spring-boot-starter:3.0.4")
implementation ("org.springframework.boot:spring-boot-starter-log4j2")
implementation ("com.lmax:disruptor:3.4.2")
modules {
module("org.springframework.boot:spring-boot-starter-logging") {
replacedBy("org.springframework.boot:spring-boot-starter-log4j2", "Use Log4j2 instead of Logback")
}
}
compileOnly ("org.projectlombok:lombok")
runtimeOnly ("mysql:mysql-connector-java")

View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8" ?>
<Configuration status="INFO" monitorInterval="30">
<Properties>
<Property name="LOG_PATH">./logs/log</Property>
<Property name="LOG_PATTERN">%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n</Property>
</Properties>
<Appenders>
<Console name="ConsoleLog" target="SYSTEM_OUT">
<PatternLayout pattern="${LOG_PATTERN}" charset="UTF-8"/>
</Console>
<RollingFile name="FileLog"
fileName="${LOG_PATH}.log"
filePattern="${LOG_PATH}-%d{yyyy-MM-dd}-%i.log">
<PatternLayout pattern="${LOG_PATTERN}" charset="UTF-8" />
<Policies>
<SizeBasedTriggeringPolicy size="15MB" />
<TimeBasedTriggeringPolicy modulate="true" interval="1" />
</Policies>
<DefaultRolloverStrategy>
<Delete basePath="${LOG_PATH}" maxDepth="1">
<IfLastModified age="30d"/>
</Delete>
</DefaultRolloverStrategy>
</RollingFile>
</Appenders>
<Loggers>
<Root level="info">
<AppenderRef ref="ConsoleLog" />
<AppenderRef ref="FileLog" />
</Root>
</Loggers>
</Configuration>