스프링 부트 3.1 이상을 사용한다면 Spring 컨테이너 관련 로그가 출력되지 않는다.
new member = memberA find Member = memberA
src/main/resources/logback.xml
파일을 만든다.
이 해결 방안은ApplicationContext
를 직접 생성해서 사용할 때만 적용된다.
CoreApplication
처럼 스프링 부트를 실행할 때는 이 파일을 제거하거나
또는<root level="DEBUG">
부분을
<root level="INFO">
로 변경하면 같은 로그를 확인할 수 있다.<configuration> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <encoder> <pattern> %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} -%kvp%msg%n </pattern> </encoder> </appender> <root level="DEBUG"> <appender-ref ref="STDOUT" /> </root> </configuration>
스프링 부트 3.1 부터 기본 로그 레벨을
INFO
로 빠르게 설정하기 때문에 로그를 확인할 수 없는데,
이렇게하면 기본 로그 레벨을DEBUG
로 설정해서 다음과 같이 로그를 확인할 수 있다.19:18:00.439 [main] DEBUG org.springframework.context.annotation.AnnotationConfigApplicationContext - Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@7cdb5 d3 19:18:00.445 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalConfigurationAnnotationProcessor ' 19:18:00.503 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.context.event.internalEventListenerProcessor' 19:18:00.504 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.context.event.internalEventListenerFactory' 19:18:00.504 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalAutowiredAnnotationProcessor' 19:18:00.505 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'org.springframework.context.annotation.internalCommonAnnotationProcessor' 19:18:00.508 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'appConfig' 19:18:00.510 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'memberService' 19:18:00.512 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'memberRepository' 19:18:00.512 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'orderService' 19:18:00.513 [main] DEBUG org.springframework.beans.factory.support.DefaultListableBeanFactory - Creating shared instance of singleton bean 'discountPolicy' new member = memberA find Member = memberA