기본 콘텐츠로 건너뛰기

4월, 2018의 게시물 표시

스프링부트, logging

Logging 스프링부트는 Java Util Logging, Log4j2, Logback을 기본적으로 제공한다. 내부적으로 apache common logging 을 사용하나 변경이 가능하다 만약 ‘Starters’를 사용한다면 Logback이 사용된다. Log Format 시간/로그레벨/process id/ 구분자(—)/ thread 명/ logger 명 / 메세지 2014-03-05 10:57:51.112 INFO 45469 --- [ main] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/7.0.52 2014-03-05 10:57:51.253 INFO 45469 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2014-03-05 10:57:51.253 INFO 45469 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1358 ms Color-coded Output 로그에 색을 입힐 수도 있다. spring.output.ansi.enabled 값을 설정해주면 된다. Enum Constants Enum Constant Description ALWAYS Enable ANSI-colored output. DETECT Try to detect whether ANSI coloring capabilities are available. NEVER Disable ANSI-colored output. File Output 기본적으로 스프링 부트는 파일에는 로그를 남기지 않고 콘솔에만 표시한다.