[Spring boot] Logback 설정
작성일자 : 2019.07.14
환경 : Spring Boot 2.1.6
Logback이란 SLF4J의 구현체로 자바 오픈소스 로깅 프레임워크
# Spring Boot의 기본 로그 객체로 포함되어 있어 Gradle이나 Maven 설정없이 바로 사용 가능
# spring-boot-starter-web 안에 spring-boot-starter-logging 포함
1. 사용 방법
application.properties
|
.. .. # 전체 로그 레벨 설정
# 특정 클래스만 설정 logging.level.com.example.demo.SpringboottestApplication=debug .. ..
|
MyClass.java
|
import org.slf4j.Logger;
public class MyClass {
private static final Logger logger = LoggerFactory.getLogger(MyClass.class);
public void method() {
logger.info("info"); logger.debug("debug");
}
} |
2. 결과
Console에서 로그 내용 확인 가능

----
로그 레벨

이미지 출처 : http://myblog.opendocs.co.kr/archives/tag/%EB%A1%9C%EA%B7%B8-%EB%A0%88%EB%B2%A8
'도구, 툴' 카테고리의 다른 글
| [docker] 기본 명령어 (0) | 2020.05.24 |
|---|---|
| GIT example (0) | 2020.05.01 |
| [ELK] Kibana (1) | 2019.01.29 |
| [ELK] Logstash (0) | 2019.01.28 |
| [ELK] Elasticsearch (0) | 2019.01.24 |