issues
search
changju
/
study-springboot
0
stars
0
forks
source link
[4부: 스프링 부트 활용] 24. 로깅 1부: 스프링 부트 기본 로거 설정
#14
Open
changju
opened
2 years ago
changju
commented
2 years ago
4부: 스프링 부트 활용
로깅 1부: 스프링 부트 기본 로거 설정
로깅 퍼사드 VS 로거
로깅 퍼사드:
Commons Logging
, SLF4j
로거: JUL, Log4j2,
Logback
스프링 5에 로거 관련 변경 사항
https://docs.spring.io/spring/docs/5.0.0.RC3/spring-framework-reference/overview.html#overview-logging
Spring-JCL
Commons Logging -> SLF4j or Log4j2
pom.xml에 exclusion 안해도 됨.
스프링 부트 로깅
기본 포맷
--debug (일부 핵심 라이브러리만 디버깅 모드로)
--trace (전부 다 디버깅 모드로)
컬러 출력: spring.output.ansi.enabled
파일 출력: logging.file 또는 logging.path
로그 레벨 조정: logging.level.패지키 = 로그 레벨
changju
commented
2 years ago
로깅 퍼사드 VS 로거
Commons Logging와 SLF4j는 Logger api를 추상화 해 놓은 인터페이스들이다. 실제 구현(impl)은 JUL(java utility log), Log4J2, Logback 이 있다.
스프링 5부터 로거 관련 변경사항이있음
Commons Logging > SLF4j or Log4j2 > Logback 으로 사용하게 된다.
스프링 5 미만의 버전에서 SLF4j를 사용하기 위해서 exclusion 했어야 했지만, 스프링 5부터는 pom.xml에 exclusion 안해도 된다.
changju
commented
2 years ago
스프링 부트 로깅
--debug
embedded container, Hibernate, Springboot 에 대한 debug 만 출력한다.
--trace
모든 패키지에 대한 로그 확인을 할 경우의 옵션이다.
logging.path
logging.path=logs 설정시
로그는 다음과 같이 기본 값을 가지고 있다.
4부: 스프링 부트 활용
로깅 1부: 스프링 부트 기본 로거 설정