【发布时间】:2014-10-14 00:34:46
【问题描述】:
我正在使用具有以下配置的 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>
如果我使用 startup.bat 启动 tomcat,我可以看到 GO.log 和 catalina.{date}.log 生成。 如果我从 Eclipse 启动 tomcat 就没有运气了。 我尝试在我的环境中定义 CATALINA_HOME。变量无济于事。
我收到此错误
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)
如何以“正确”的方式通过 Eclipse 启动 Tomcat,从而允许我登录到 GO.log 文件?
【问题讨论】:
标签: java eclipse tomcat logging slf4j