[TIL] 22.07.21

진이진이·2022년 7월 22일
0

TIL

목록 보기
62/74
post-custom-banner

Spring boot logback

<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="30 seconds">
    <!--로그 파일 저장 위치-->
    <property name="LOGS_PATH" value="C:/Users/#{사용자}/Desktop/project/cracker_log/"/>>
    <appender name="ROLLING" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <filter class="ch.qos.logback.classic.filter.ThresholdFilter">
            <level>WARN</level>
        </filter>

        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!-- rollover daily -->
            <fileNamePattern>${LOGS_PATH}log-%d{yyyy-MM-dd_HH_mm}.%i.txt</fileNamePattern>
            <timeBasedFileNamingAndTriggeringPolicy
                    class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
                <!-- or whenever the file size reaches 100MB -->
                <maxFileSize>10MB</maxFileSize>
            </timeBasedFileNamingAndTriggeringPolicy>
            <maxHistory>30</maxHistory>
        </rollingPolicy>

        <encoder>
            <pattern>[%-5level] %d{HH:mm:ss.SSS} %logger{36} %M - %msg%n</pattern>
        </encoder>

    </appender>
    <root level="debug">
        <appender-ref ref="ROLLING"/>
    </root>
</configuration>
profile
개발 어린이
post-custom-banner

0개의 댓글