每次tomcat启动的时候都报这个错误,但是log4j已经配置好了,今天查了一下资料,原来是在tomcat/common/lib下多放了一个log4j的包的原因
原文:
Did you put a copy of log4j.jar back into common/lib? That error is coming
from commons-logging finding Log4j and using it in preference to j2sdk1.4.x
logging, but if Log4j doesn't, then, find its configuration, you will get
that error. Note that commons-logging does a bunch of classloading
trickery to find and load external logging packages. It is entirely
possible that it might be using the context class loader to find Log4j,
thus being able to bypass the normal Java2 classloader hierarchy (where
only classloader higher in the hierarchy are visible). However, I just
tested having log4j.jar in my WEB-INF/lib and not in common/lib and
commons-logging in common/lib couldn't see it (and, therefore, didn't get
the Log4j error), so it is most likely that you have log4j.jar in
common/lib (or shared/lib) or some other place where commons-logging in
Tomcat can see log4j.jar. Remove Log4j.jar and you won't see that
error....or, I suppose, you could add log4j.xml or log4j.properties to
common/classes and all would be well.