ちょっとハマったのでメモ。 log4j.properties(log4j.xml)の場所はweb.xmlに設定すればよいようだ。 <context-param> <param-name>log4jConfigLocation</param-name> <param-value>/WEB-INF/log4j.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> </listener> 参考にした以下のサイトではSpring 2.5だったが、Spring 3.1でも同じだった。 http://www.ne.jp/asahi/hishidama/home/tech/java/spring/spring25.html また、Log4jConfigListenerは、ContextLoaderListenerよりも先に記述する。 <listener> <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class> </listener> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> こうしないと、DIコンテナの設定がlog4jの設定よりも先に行われ、Springのログが最初出力されない。以下のようなWarningログが出る。 log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader). log4j:WARN