到目前为止,当log4j备份旧的日志文件时,它将其重命名为smth。像这样"创建日期"。" counter" .log。如何以下列方式备份:"创建日期" - "创建时间" .log?我的意思是如何将创建时间(小时和分钟)嵌入到保存的日志文件名中?在它下面是我的log4j cfg.file的一部分:
<appender name="TCPIP" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${logDir}/radius.log</file>
<append>true</append>
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<!-- Only errors will be written to this file -->
<level>WARNING</level>
</filter>
<encoder>
<pattern>${defaultPattern}</pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<fileNamePattern>${logDir}/tcpip/%d.%i.log</fileNamePattern>
<maxHistory>${maxHistory}</maxHistory>
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
<maxFileSize>${maxFileSize}</maxFileSize>
</timeBasedFileNamingAndTriggeringPolicy>
</rollingPolicy>
</appender>