启动 tomcat 导致 catalina.out 中出现“java.io.FileNotFoundException: ../logs/dc.log (没有这样的文件或目录)”

启动 tomcat 导致 catalina.out 中出现“java.io.FileNotFoundException: ../logs/dc.log (没有这样的文件或目录)”

多年来,我一直将此视为 tomcat 应用程序的一部分,现在我已经完成了调查它的步骤,但我找不到原因。这是我在运行各种应用程序的 CentOS 服务器上启动 tomcat 时看到的内容:

May 1, 2014 8:50:29 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: /usr/lib/jv    m/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64/server:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x86_64/jre/lib/amd64:/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0.x8    6_64/jre/../lib/amd64:/usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
May 1, 2014 8:50:29 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
May 1, 2014 8:50:29 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1382 ms
May 1, 2014 8:50:29 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
May 1, 2014 8:50:29 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.24
May 1, 2014 8:50:29 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive ROOT.war
log4j:ERROR setFile(null,true) call failed.
java.io.FileNotFoundException: ../logs/dc.log (No such file or directory)
        at java.io.FileOutputStream.openAppend(Native Method)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:210)
        at java.io.FileOutputStream.<init>(FileOutputStream.java:131)
        at org.apache.log4j.FileAppender.setFile(FileAppender.java:290)
        at org.apache.log4j.RollingFileAppender.setFile(RollingFileAppender.java:194)
        at org.apache.log4j.FileAppender.activateOptions(FileAppender.java:164)
        at org.apache.log4j.config.PropertySetter.activate(PropertySetter.java:257)
        at org.apache.log4j.xml.DOMConfigurator.parseAppender(DOMConfigurator.java:285)
        at org.apache.log4j.xml.DOMConfigurator.findAppenderByName(DOMConfigurator.java:171)
        at org.apache.log4j.xml.DOMConfigurator.findAppenderByReference(DOMConfigurator.java:184)
        at org.apache.log4j.xml.DOMConfigurator.parseChildrenOfLoggerElement(DOMConfigurator.java:502)
        at org.apache.log4j.xml.DOMConfigurator.parseCategory(DOMConfigurator.java:415)
        at org.apache.log4j.xml.DOMConfigurator.parse(DOMConfigurator.java:919)
        at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:790)
        at org.apache.log4j.xml.DOMConfigurator.doConfigure(DOMConfigurator.java:696)
        at org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:471)
        at org.apache.log4j.LogManager.<clinit>(LogManager.java:125)
        at org.apache.log4j.Logger.getLogger(Logger.java:105)
        at org.apache.commons.logging.impl.Log4JLogger.getLogger(Log4JLogger.java:229)
        at org.apache.commons.logging.impl.Log4JLogger.<init>(Log4JLogger.java:65)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:534)
        at org.apache.commons.logging.impl.LogFactoryImpl.newInstance(LogFactoryImpl.java:529)
        at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:235)
        at org.apache.commons.logging.impl.LogFactoryImpl.getInstance(LogFactoryImpl.java:209)
        at org.apache.commons.logging.LogFactory.getLog(LogFactory.java:351)
        at org.springframework.util.PropertyPlaceholderHelper.<clinit>(PropertyPlaceholderHelper.java:40)
        at org.springframework.util.SystemPropertyUtils.<clinit>(SystemPropertyUtils.java:49)
        at org.springframework.util.Log4jConfigurer.initLogging(Log4jConfigurer.java:66)
        at org.springframework.web.util.Log4jWebConfigurer.initLogging(Log4jWebConfigurer.java:151)
        at org.springframework.web.util.Log4jConfigListener.contextInitialized(Log4jConfigListener.java:45)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3972)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:4467)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:526)
        at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:905)
        at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:740)
        at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:500)
        at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1277)
        at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
        at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
        at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
        at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
        at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
        at org.apache.catalina.core.StandardService.start(StandardService.java:516)
        at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
        at org.apache.catalina.startup.Catalina.start(Catalina.java:593)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:622)
        at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
        at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)

它从未导致任何问题,但我在服务器上的任何配置文件中都找不到“dc.log”,更不用说 tomcat 了,所以我不知道是什么导致了这个错误。谷歌搜索没有得到任何结果,这让我难以置信。我该如何找到它?

答案1

提示在异常中:log4j 正在抱怨。假设您检查的配置文件全部在 中$TOMCAT_HOME/conf,您将需要深入研究 部署的属性文件ROOT.war

grep -r dc.log webapps是获得所需内容的最懒惰的方法。

(换句话说,责怪你的开发人员。)

相关内容