정미나닷컴

[Java] Spring boot 날짜별로 로그 쌓기 본문

programming

[Java] Spring boot 날짜별로 로그 쌓기

정미나 2021. 11. 10. 19:39
반응형
<?xml version="1.0" encoding="UTF-8"?> <configuration scan="true" scanPeriod="300 seconds"> <!--property resource="application.properties"/--> <appender name="FILE_LOCAL" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>D:/로그파일경로/minaLog.log</file> <append>true</append> <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> <fileNamePattern>D:/로그파일경로/minaLog-%d{yyyy-MM-dd}.%i.log</fileNamePattern> <maxFileSize>100MB</maxFileSize> <maxHistory>10</maxHistory> </rollingPolicy> <encoder> <pattern> %d{yyyy-MM-dd HH:mm:ss.SSS} %highlight(%-5level) [ %cyan(%logger) ] : %msg%n </pattern> </encoder> </appender> <property name="DIR_SERVER" value="서버로그파일경로"/> <appender name="FILE_SERVER" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>${DIR_SERVER}/minaLog.log</file> <append>true</append> <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy"> <fileNamePattern>${DIR_SERVER}/minaLog-%d{yyyy-MM-dd}.%i.log</fileNamePattern> <maxFileSize>100MB</maxFileSize> <maxHistory>90</maxHistory> </rollingPolicy> <encoder> <pattern> %d{yyyy-MM-dd HH:mm:ss.SSS} %highlight(%-5level) [ %cyan(%logger) ] : %msg%n </pattern> </encoder> </appender> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <layout class="ch.qos.logback.classic.PatternLayout"> <pattern>%d{yyyy-MM-dd HH:mm:ss} [%-5p] [%F]%M\(%L\) : %m%n</pattern> </layout> </appender> <logger name="org.springframework" level="INFO" /> <logger name="jdbc.sqltiming" level="INFO" /> <logger name="jdbc.sqlonly" level="DEBUG" /> <logger name="jdbc.resultsettable" level="DEBUG" /> <logger name="org.apache.http.impl.conn" level="OFF" /> <logger name="jdbc" level="OFF"/> <!-- 설정 파일의 active에 따라 로그 출력 --> <springProfile name="prod"> <root level="DEBUG"> <appender-ref ref="FILE_SERVER"/> </root> </springProfile> <springProfile name="dev"> <root level="DEBUG"> <appender-ref ref="FILE_SERVER"/> </root> </springProfile> <springProfile name="local"> <root level="DEBUG"> <appender-ref ref="STDOUT" /> <appender-ref ref="FILE_LOCAL"/> </root> </springProfile> </configuration>
반응형
0 Comments
댓글쓰기 폼