์ปค๋ฐ ๋ฉ์์ง ํ์์ ์๋์ ๊ฐ์ต๋๋ค. subject
๊น์ง๋ง ์์ฑํด๋ ๊ด์ฐฎ์ต๋๋ค.
<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>
feat
: (feature)fix
: (bug fix)docs
: (documentation)style
: (formatting, missing semi colons, โฆ)refactor
test
: (when adding missing tests)chore
: (maintain)
- main
- develop
- feature
- release
- hotfix
src/main/resources/logback-spring.xml์์ logback ์ค์ ํ์ผ์ ํ์ธํ ์ ์์ต๋๋ค.
<configuration>
<property name="CONSOLE_LOG_PATTERN"
value="[%d{HH:mm:ss.SSS}] [%blue(%X{request_id})] %green([%thread]) %highlight(%-5level) %boldWhite([%C.%M:%yellow(%L)]) - %msg%n" />
<!--๋ก๊ทธ ํจํด์ property๋ก ๋ฑ๋กํ์ฌ ๊ด๋ฆฌํ๋ค. %d๋ ๋ ์ง, %X๋ MDC์ ์ ์ฅ๋ ๊ฐ์ ๋ถ๋ฌ์ฌ ์ ์๋ค.-->
<property name="FILE_LOG_PATTERN"
value="[%d{HH:mm:ss.SSS}] [%blue(%X{request_id})] %green([%thread]) %highlight(%-5level) %boldWhite([%C.%M:%yellow(%L)]) - %msg%n" />
<property name="LOG_PATH" value="./logs" />
<appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="FILE_INFO">
<encoder>
<pattern>${FILE_LOG_PATTERN}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>INFO</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
<!-- INFO๋ฅผ ์ ์ธํ ๋ค๋ฅธ ๋ ๋ฒจ์ ๋ก๊ทธ๋ ์ ์ธํ๋ ํํฐ -->
</filter>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_PATH}/%d{yyyy-MM}/info-%d{yyyy-MM}.log</fileNamePattern>
<!-- LOG_PATH ์์ฑ๊ฐ ๊ฒฝ๋ก / ์ฐ์ / info-์ฐ์.log ๊ฒฝ๋ก์ ์ ์ฅ๋๋ค -->
<maxHistory>12</maxHistory>
<!-- info ๋ ๋ฒจ์ ๋ก๊ทธ ํ์ผ์ด 12๊ฐ๊ฐ ๋์ด๊ฐ๋ฉด ์ค๋๋ ๋ก๊ทธ ํ์ผ์ ์ญ์ ํ๋ค(1๋
) -->
<totalSizeCap>100MB</totalSizeCap>
<!-- ๋ง์ฝ ํ๋์ ๋ก๊ทธ ํ์ผ์ด 100MB๊ฐ ๋์ด๊ฐ๋ฉด ๋กค๋งํ๋ค. -->
</rollingPolicy>
</appender>
<appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="FILE_WARN">
<encoder>
<pattern>${FILE_LOG_PATTERN}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>WARN</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_PATH}/%d{yyyy-MM}/warn-%d{yyyy-MM}.log</fileNamePattern>
<maxHistory>12</maxHistory>
<totalSizeCap>100MB</totalSizeCap>
</rollingPolicy>
</appender>
<appender class="ch.qos.logback.core.rolling.RollingFileAppender" name="FILE_ERROR">
<encoder>
<pattern>${FILE_LOG_PATTERN}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOG_PATH}/%d{yyyy-MM}/error-%d{yyyy-MM}.log</fileNamePattern>
<maxHistory>12</maxHistory>
<totalSizeCap>100MB</totalSizeCap>
</rollingPolicy>
</appender>
<springProfile name="develop">
<!-- profile์ด develop(local ํ๊ฒฝ)์ผ ๊ฒฝ์ฐ ์ฝ์์ ๋ก๊ทธ๋ฅผ ์ถ๋ ฅํ๋ค -->
<appender class="ch.qos.logback.core.ConsoleAppender" name="STDOUT">
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
</encoder>
</appender>
<root level="INFO">
<appender-ref ref="STDOUT" />
</root>
<!-- INFO ์ด์์ ๋ ๋ฒจ์ ๋ํด name์ด STDOUT์ธ appender์ ์ด๋ฒคํธ๋ฅผ ๋ฐํํ๋ค -->
</springProfile>
<springProfile name="test">
<property name="LOG_PATH" value="~/TipiTapiTestServer/log" />
<!-- ๋ก๊ทธ ํ์ผ ๊ฒฝ๋ก๋ฅผ ~/TipiTapiTestServer/log๋ก ์ค์ ํ๋ค.-->
<!-- ๋ฐ๋ผ์ FILE_INFO ๋ฑ์ appender๊ฐ ํด๋น ๊ฒฝ๋ก๋ก ๋ก๊ทธ๋ฅผ ์ ์ฅํ๋ค -->
<root level="INFO">
<appender-ref ref="FILE_INFO" />
<appender-ref ref="FILE_WARN" />
<appender-ref ref="FILE_ERROR" />
</root>
</springProfile>
<springProfile name="prod">
<property name="LOG_PATH" value="~/SpringServer/log" />
<root level="INFO">
<appender-ref ref="FILE_INFO" />
<appender-ref ref="FILE_WARN" />
<appender-ref ref="FILE_ERROR" />
</root>
</springProfile>
</configuration>