我有一个带有以下logback配置的应用
<?xml version="1.0" encoding="UTF-8"?>
<configuration debug="true">
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level{5} %logger - %msg%n</pattern>
</encoder>
</appender>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${HOME}/app.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${HOME}/old/app-%d{yyyy-MM-dd}.%i.gz</fileNamePattern>
<timeBasedFileNamingAndTriggeringPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>100MB</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
<maxHistory>14</maxHistory>
</rollingPolicy>
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{5} - %msg%n</pattern>
</encoder>
</appender>
<appender name="EXCEPTIONS" class="com.software.nagibator.emulator.logging.ExceptionsAppender">
<connectionSource class="ch.qos.logback.core.db.JNDIConnectionSource">
<jndiLocation>jdbc/AppExceptions</jndiLocation>
</connectionSource>
</appender>
<logger name="FileLogger" level="DEBUG" additivity="false">
<appender-ref ref="FILE" />
</logger>
<logger name="ExceptionsLogger" level="DEBUG" additivity="false">
<appender-ref ref="EXCEPTIONS" />
</logger>
<root level="DEBUG">
<appender-ref ref="STDOUT" />
</root>
</configuration>
我在两个ubuntu服务器上使用此配置。在第一台服务器上,配置按预期工作(它将日志写入文件)。但是,在第二台服务器上,logback不会将日志写入文件。
我的配置是否有问题,或者是项目中其他地方的错误?
答案 0 :(得分:0)
</rollingPolicy>
ch.qos.logback.classic.encoder.PatternLayoutEncoder by default -->
<encoder>
...
它看起来像你想念&lt; ! - 在xml中发表评论之前。