---
title: "问个spring自身框架中的log.info()怎么才能不往catalina.out写的问题"
author: "jd2bs"
date: "2015-10-14T17:23:19Z"
tags: []
categories: ["企业架构"]
slug: "spring-log-info-catalina-out"
draft: false
lastmod: "2015-10-14T17:23:19Z"
id: 2249154
url: "https://jd2bs.iteye.com/blog/2249154"
---

最近检查server看到某机器tomcat下catalina.out文件高达8G大小，严重影响了web应用。 
手工删除后问题暂时解决；后来查看该文件发现大多数是spring 框架中本身的info信息，比如"Mapped Url path"这种映射信息。 

我在log4j.properties中设置 
log4j.rootCategory=ERROR,stdout,files 

//stdout->ConsoleAppender,files ->DailyRollingFileAppender 
并且加上： 
log4j.logger.org.springframework=ERROR 

结果， spring 框架中本身的info信息，比如"Mapped Url path"这种映射信息还是写入了catalina.out; 应用自己的info倒是成功过滤掉了 


web.xml中是配置了Log4jConfigListener的，并且配在spring的listener之前 

spring是3.2.2版本，我看了源码spring中的log是commons-logging，按理是可以和log4j集成的。不知为何tomcat启动过程中，spring自身的debug,info,warn信息就是不能过滤掉。难道要spring app全部加载完毕了，log4j配置才起作用？感觉没道理啊，log4j listener明明配在spring listener之前的 

 :arrow: