-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
57 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<configuration> | ||
<!-- 콘솔에 출력되는 패턴 --> | ||
<property name="CONSOLE_LOG_PATTERN" | ||
value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %clr(%5level) %cyan(%logger) - %msg%n"/> | ||
<!-- 파일에 기록되는 패턴 --> | ||
<property name="FILE_LOG_PATTERN" value="%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %5level %logger - %msg%n"/> | ||
|
||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/> | ||
|
||
<!-- 콘솔로그 --> | ||
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> | ||
<encoder> | ||
<pattern>${CONSOLE_LOG_PATTERN}</pattern> | ||
</encoder> | ||
</appender> | ||
|
||
<!-- 파일로그 --> | ||
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> | ||
<encoder> | ||
<pattern>${FILE_LOG_PATTERN}</pattern> | ||
</encoder> | ||
<!-- RollingPocliy: 로그를 나눠서 기록 --> | ||
<!-- SizeAndTimeBasedRollingPolicy: 로그파일을 크기, 시간 기반으로 관리 --> | ||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> | ||
<!-- 로그파일명 패턴 --> | ||
<!-- 날짜별로 기록되며 maxFileSize를 넘기면 인덱스(i)를 증가시켜 새로운 이름의 로그파일에 기록을 이어간다 --> | ||
<fileNamePattern>logs/%d{yyyy-MM-dd}/%i.log</fileNamePattern> | ||
<!-- 로그파일 최대사이즈 --> | ||
<maxFileSize>100MB</maxFileSize> | ||
<!-- 생성한 로그파일 관리 일수 --> | ||
<maxHistory>14</maxHistory> | ||
</rollingPolicy> | ||
</appender> | ||
|
||
<!-- local --> | ||
<springProfile name="local"> | ||
<!-- 전체적인 로그는 INFO 레벨 부터 출력 --> | ||
<root level="INFO"> | ||
<appender-ref ref="CONSOLE"/> | ||
</root> | ||
</springProfile> | ||
<!-- prod --> | ||
<springProfile name="prod"> | ||
<root level="INFO"> | ||
<appender-ref ref="CONSOLE"/> | ||
<appender-ref ref="FILE"/> | ||
</root> | ||
</springProfile> | ||
</configuration> |