로그 : 프로그램의 오류, 운영정보의 기록.
로그를 남길때 사용할수 있는 라이브러리가 logback임.
logger: 로깅을 하는 데 사용되는 클래스
appender : 어디로 출력할지 정하는 클래스(xml에서 설정.)
layout : 출력 형식을 결정하는 데 사용되는 클래스.
Basic Selection Rule
A log request of level p issued to a logger having an effective level q, is enabled if p >= q.
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<!--로그 파일 저장 위치-->
<property name="LOGS_PATH" value="./logs"/>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<layout class="ch.qos.logback.classic.PatternLayout">
<Pattern>%d{HH:mm} %-5level %logger{36} - %msg%n</Pattern>
</layout>
</appender>
<appender name="DAILY_ROLLING_FILE_APPENDER" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${LOGS_PATH}/logback.log</file>
<encoder>
<pattern>[%d{yyyy-MM-dd HH:mm:ss}:%-3relative][%thread] %-5level %logger{35} - %msg%n</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${LOGS_PATH}/logback.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<!-- or whenever the file size reaches 100MB -->
<maxFileSize>5MB</maxFileSize>
<!-- kb, mb, gb -->
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>30</maxHistory>
</rollingPolicy>
</appender>
<logger name="com.ldstr.gateway" level="INFO">
<appender-ref ref="DAILY_ROLLING_FILE_APPENDER" />
</logger>
<root level="INFO">
<appender-ref ref="STDOUT" />
</root>
<logger name="jdbc" level="OFF"/>
<logger name="jdbc.sqlonly" level="OFF"/>
<logger name="jdbc.sqltiming" level="DEBUG"/>
<logger name="jdbc.audit" level="OFF"/>
<logger name="jdbc.resultset" level="OFF"/>
<logger name="jdbc.resultsettable" level="DEBUG"/>
<logger name="jdbc.connection" level="OFF"/>
</configuration>
https://blog.daum.net/question0921/1293
https://hochoon-dev.tistory.com/entry/JAVA-Logback-%EC%82%AC%EC%9A%A9%EB%B2%95
https://www.bubblecat.co.kr/2019/05/logback.html
https://jeong-pro.tistory.com/154