개요

스프링 부트에서 log4j2를 사용할 때 쓰는 의존성을 spring boot reference를 찾아보고 정리해둔다.

의존성 설정

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter</artifactId>
    <exclusions>
    <exclusion>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-logging</artifactId>
    </exclusion>
    </exclusions>
</dependency>
<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>

Logger

Logger는 아래와 같이 사용한다.

import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.LogManager;

Logger logger = LogManager.getLogger(AggrServiceTest.class);