Skip to content

Latest commit

ย 

History

History
136 lines (115 loc) ยท 4.88 KB

convention.md

File metadata and controls

136 lines (115 loc) ยท 4.88 KB

๊ฐœ๋ฐœ ์ปจ๋ฒค์…˜ & ํ˜‘์—… ์ „๋žต

์ปค๋ฐ‹ ๋ฉ”์‹œ์ง€

์ปค๋ฐ‹ ๋ฉ”์‹œ์ง€ ํ˜•์‹์€ ์•„๋ž˜์™€ ๊ฐ™์Šต๋‹ˆ๋‹ค. subject๊นŒ์ง€๋งŒ ์ž‘์„ฑํ•ด๋„ ๊ดœ์ฐฎ์Šต๋‹ˆ๋‹ค.

<type>(<scope>): <subject>
<BLANK LINE>
<body>
<BLANK LINE>
<footer>

์ปค๋ฐ‹ ํƒ€์ž…(<Type>)

  • 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>