개발용 메모장...

[Java]/[Spring]

[SpringBoot] Logback 설정

redeyesboy 2024. 8. 27. 11:32

1. Logback 기본 설정

- application.properties

logging.charset.file=UTF-8
logging.logback.rollingpolicy.max-history=7
logging.logback.rollingpolicy.max-file-size=10MB
logging.logback.rollingpolicy.file-name-pattern=D:/logs/store/backoffice.%d{yyyy-MM-dd}.%i.gz
logging.pattern.file=%-5level %d{YY.MM.dd HH:mm} [ %logger{32}:%line ] %msg%n
logging.pattern.console=%-5level %d{YY.MM.dd HH:mm} [ %logger{32}:%line ] %msg%n
logging.file.name=D:/logs/store/backoffice/backoffice.log

 

2. Logging Group 설정

- application.properties

logging.group.framework=org.apache,org.springframework,org.mybatis
logging.group.etc=log4jdbc.debug
logging.group.db=com.zaxxer.hikari
logging.group.jdbc-viewer=jdbc.sqltiming,jdbc.resultsettable
logging.group.jdbc-off=jdbc,jdbc.connection,jdbc.sqlonly,jdbc.audit,jdbc.resultset,jdbc.connection
logging.group.off=co.kr.store.bo.Application

 

3. Logging Group별 Log Level 설정

- application.properties

logging.level.fwork=info
logging.level.etc=warn
logging.level.db=error
logging.level.jdbc-viewer=info
logging.level.jdbc-off=off
logging.level.off=off
logging.level.co.kr.store=info
logging.level.root=debug