简体   繁体   English

通过Eclipse启动应用程序和服务器时未创建Tomcat日志

[英]Tomcat log is not created when the application and server are started through eclipse

I'm using slf4j with the following configuration 我正在使用以下配置的slf4j

<appender name="FILE" class="ch.qos.logback.core.FileAppender">
        <file>${CATALINA_HOME}/logs/GO.log</file>
        <encoder>
            <pattern>%date %-5level [%thread] - [%logger] - %msg%n</pattern>
        </encoder>
    </appender>

 <root level="DEBUG">
        <appender-ref ref="stdout"/>
        <appender-ref ref="FILE"/>
 </root>

If I start tomcat using startup.bat I can see the GO.log and the catalina.{date}.log get generated. 如果我使用startup.bat启动tomcat,则可以看到GO.log和catalina。{date} .log生成。 If I start tomcat from Eclipse no luck. 如果我从Eclipse启动tomcat,那就没有运气了。 I tried defining CATALINA_HOME in my env. 我尝试在环境中定义CATALINA_HOME。 variables to no avail. 变量无济于事。

I get this error 我得到这个错误

14:26:54,179 |-ERROR in ch.qos.logback.core.FileAppender[FILE] - openFile(CATALINA_HOME_IS_UNDEFINED/logs/GO.log,true) call failed. java.io.FileNotFoundException: CATALINA_HOME_IS_UNDEFINED\logs\GLOBE_ONE.log (The system cannot find the path specified)
      at java.io.FileNotFoundException: CATALINA_HOME_IS_UNDEFINED\logs\GO.log (The system cannot find the path specified)
      at    at java.io.FileOutputStream.open(Native Method)
      at    at java.io.FileOutputStream.<init>(FileOutputStream.java:206)

How can I start the Tomcat through Eclipse in a "correct" manner which would allow me to log to the GO.log file? 如何以“正确”的方式通过Eclipse启动Tomcat,这将允许我登录到GO.log文件?

Despite specifying an env var CATALINA_HOME and despite giving the eclipse these args - Dcatalina.base="C:\\apache-tomcat-7.0.47" -Dcatalina.home="C:\\apache-tomcat-7.0.47" -Dwtp.deploy="C:\\apache-tomcat-7.0.47\\webapps" -Djava.endorsed.dirs="C:\\apache-tomcat-7.0.47\\endorsed" Eclipse still couldn't find the log directory. 尽管指定了Dcatalina.base="C:\\apache-tomcat-7.0.47" -Dcatalina.home="C:\\apache-tomcat-7.0.47" -Dwtp.deploy="C:\\apache-tomcat-7.0.47\\webapps" -Djava.endorsed.dirs="C:\\apache-tomcat-7.0.47\\endorsed" var CATALINA_HOME,并且给了这些参数,但它们使Dcatalina.base="C:\\apache-tomcat-7.0.47" -Dcatalina.home="C:\\apache-tomcat-7.0.47" -Dwtp.deploy="C:\\apache-tomcat-7.0.47\\webapps" -Djava.endorsed.dirs="C:\\apache-tomcat-7.0.47\\endorsed" Eclipse仍然找不到日志目录。

So I created the CATALINA_HOME variable under the environments tabs of server configuration. 因此,我在服务器配置的环境选项卡下创建了CATALINA_HOME变量。 I gave that variable a value C:\\apache-tomcat-7.0.47 and that did the trick. 我给该变量赋了一个值C:\\ apache-tomcat-7.0.47,然后就成功了。

Hope it helps other folks. 希望它对其他人有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在服务器中启动应用程序时,printStackTrace()日志的位置 - Location of printStackTrace() log when application is started in server 查找服务器tomcat是否启动? - Find the server tomcat started or not? 在Tomcat上通过Eclipse运行项目时出现404 - 404 when running project through eclipse on Tomcat 无法在Apache Tomcat服务器上启动Spring Boot应用程序(WAR文件) - Spring Boot Application(WAR file) could not be started On Apache Tomcat Server 当我通过eclipse重新运行应用程序时,Tomcat删除我所有上传的图像 - Tomcat deleting my all uploaded images when ever i re-run application through eclipse Eclipse和tomcat,但从“目标”目录运行Web应用程序(由Maven创建) - Eclipse and tomcat but run web application from 'target' directory (created by maven) 从Netbeans部署时无法启动Tomcat应用程序 - Tomcat application cannot be started when deployed from Netbeans 通过 netbeans 在 tomcat 服务器上部署应用程序 - Deploying application on tomcat server through netbeans 如何在Eclipse IDE的Apache Tomcat服务器中部署创建的.jar文件? - How to deploy created .jar file in Apache Tomcat server in Eclipse IDE? 使用Java在eclipse中创建的Jersey Tomcat Web服务器的404错误 - 404 Error for a Jersey Tomcat web server created in eclipse with java
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM