我正在使用loback进行记录,这是我的配置文件:
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true">
<appender name="LOG"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<!--See also http://logback.qos.ch/manual/appenders.html#RollingFileAppender -->
<File>
/logs/tomcat/simulator.log</File>
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<maxIndex>10</maxIndex>
<FileNamePattern>/logs/tomcat/simulator.log.%i</FileNamePattern>
</rollingPolicy>
<triggeringPolicy
class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>10MB</MaxFileSize>
</triggeringPolicy>
</appender>
<logger name="my package here" level="DEBUG" />
<root level="ERROR">
<appender-ref ref="LOG" />
</root>
</configuration>
如您所见,我将日志文件指定为
/logs/tomcat/simulator.log
我所做的是在apache tomcat 部署时,没有任何内容写入该文件。 我错过了什么? 当我登录日志(catalina.out)时,我发现此异常更新
FileNotFoundException: /logs/tomcat/simulator.log (No such file or directory)