본문 바로가기

JAVA - Backend/SpringBoot - ApplicationFramework

spring-boot-starter-logging

참고
https://docs.spring.io/spring/docs/5.0.0.RC3/spring-framework-reference/overview.html#overview-logging

 

Overview of Spring Framework

The Spring Framework is a Java platform that provides comprehensive infrastructure support for developing Java applications. Spring handles the infrastructure so you can focus on your application. Spring enables you to build applications from "plain old Ja

docs.spring.io

핵심라이브러리 자세한 디버그 보기 VM options -Ddebug 또는 Program arguments: --debug, 전부: --trace

main>resources>log4j2.xml

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO">
    <Appenders>
        <Console name="console" target="SYSTEM_OUT">
            <PatternLayout pattern="[%-5level] %d{yyyy-MM-dd HH:mm:ss.SSS} [%t] %c{1} - %msg%n"/>
        </Console>
    </Appenders>
    <Loggers>
        <Root level="info" additivity="false">
            <AppenderRef ref="console"/>
        </Root>
    </Loggers>
</Configuration>

Gradle

implementation 'org.springframework.boot:spring-boot-starter-log4j2'
configurations {
all*.exclude module : 'spring-boot-starter-logging'
}

스프링 부트 2

- 스프링 부트의 기본 로거는 Logback이다.
- 프로젝트 전체 또는 패키지별로 로그 레벨 설정 가능 (중복될 경우 낮은레벨로 적용)

debug=true
logging.level.org.springframework=ERROR 
logging.level.com.howtodoinjava=TRACE