코딩 관련/Spring 관련
[Spring] 아파치 로그찍기 log4j 사용
메리짱123
2020. 9. 16. 09:34
반응형
1. 다운로드
logging.apache.org/log4j/1.2/download.html
Apache log4j 1.2 - Download Apache log4j 1.2
Log4j 2 is nominated for the JAX Innovation Awards! Do you like its performance, garbage-free logging, and easy and flexible configuration? Log4j 2 needs your love. Vote for Log4j 2! End of Life On August 5, 2015 the Logging Services Project Management Com
logging.apache.org
log4j-1.2.17.zip파일 다운로드 > 압축 해제
2. jar 파일을 라이브러리에 추가 spring의 경우 pom.xml에 dependency 있는지 확인
3. /src/main/resources 밑에 log4j.xml
open with xml editor
appender : 로그를 출력하는 위치
logger : 로그 파일을 작성하는 클래스
사용
import org.apache.log4j.Logger
임포트
Logger log = Logger.getLogger(This.getClass));
로거 생성
if(log.isDebugEnabled()) {
log.debug("로그 내용")
} 로그 찍기
반응형