스프링 MVC 프로젝트를 만들면 기본으로 프로젝트 이름 src/main/resources 폴더에 생성되는 로그 환경 설정 파일 log4j.xml을 살펴보겠습니다.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<!-- Appenders -->
➊
<appender name="console" class="org.apache.log4j.ConsoleAppender"><param name="Target" value="System.out"/> ➋
➌
<layout class="org.apache.log4j.PatternLayout">
<param name="ConversionPattern" value="%-5p: %c - %m%n"/> ➍
</layout>
</appender>
<!-- Application Loggers -->
➎
<logger name="com.springmvc.controller">
<level value="info"/> ➏
</logger>
<!-- 3rdparty Loggers -->
➎
<logger name="org.springframework.core">
<level value="info"/> ➏
</logger>
➎
<logger name="org.springframework.beans">
<level value="info"/> ➏
</logger>
➎
<logger name="org.springframework.context">
<level value="info"/> ➏
</logger>
➎
<logger name="org.springframework.web">
<level value="info"/> ➏
</logger>
<!-- Root Logger -->
➐
<root>
<priority value="warn"/> ➑
<appender-ref ref="console"/> ➒
</root>
</log4j:configuration>