我正在使用logback.xml,并在下面的logback.xml中配置了基于时间的文件滚动,如下所示,但是每天它都没有按模式中的名称重命名文件。它将在午夜更新同一文件tp.log。
我想念什么吗?
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>%d [%thread] %-5level %logger{36} - %msg%n</Pattern>
</encoder>
</appender>
<appender name="TIME_BASED_FILE_ROLLING" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>/opt/sts/tp/logs/tp.log</file>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- daily rollover -->
<fileNamePattern>../logs/tp.%d{yyyy-MM-dd}.log</fileNamePattern>
<maxHistory>100</maxHistory>
</rollingPolicy>
<encoder>
<pattern>%d [%thread] %-5level %logger{35} - %msg%n</pattern>
</encoder>
</appender>
<springProfile name="default">
<logger name="org.tp" level="INFO" additivity="false">
<appender-ref ref="TIME_BASED_FILE_ROLLING" />
</logger>
</springProfile>
<springProfile name="test">
<logger name="org.tp" level="INFO" additivity="false">
<appender-ref ref="TIME_BASED_FILE_ROLLING" />
</logger>
</springProfile>
<root level="info">
<appender-ref ref="TIME_BASED_FILE_ROLLING" />
</root>