실행 과정 중 로그를 확인 해야 하는 경우가 있는데 스프링 부트 3.1.x 이상부터는 변경사항이 생긴것 같다.
스프링 부트 3.1 미만 버전
19:18:00.439 [main] DEBUG org.springframework.context.annotation.AnnotationConfigApplicationContext - Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@7cdbc5d3
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
이렇게 나오던 로그가
3.1 이후 버전
new member = memberA
find Member = memberA
이렇게 뜬다
해결 방법
src/main/resources/logback.xml
해당 위치에 아래와 같은 xml를 작성해서 실행하면 된다!
<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>
이러면
로그가 잘 뜨는걸 확인할 수 있다!
출처: 인프런 김영한T
'Spring' 카테고리의 다른 글
[Spring] 롬복(lombok)이란? (2) | 2024.01.08 |
---|---|
[Spring] @Configuration과 싱글톤, 바이트 코드 조작 (0) | 2024.01.06 |
[Spring] 싱글톤 패턴이란 (1) | 2024.01.05 |
[Spring] BeanFactory, ApplicationContext의 개념, 차이점 (1) | 2024.01.05 |
[Spring] 스프링 컨테이너, 스프링 빈의 사용법(@Configuration, @Bean) (1) | 2024.01.03 |