将RollingFlie Appender配置为在每天的午夜和中午进行过渡 [英] Configure RollingFlie Appender to rollover at midnight and midday of each day

查看:50
本文介绍了将RollingFlie Appender配置为在每天的午夜和中午进行过渡的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以帮忙如何用RollingFile附加程序配置log4j2,该附加程序每天生成两个日志文件(AM/PM)吗?

Can someone please help on how to configure log4j2 with RollingFile appender which generates two log files per day (AM/PM)?

试过这个,但是不行

<RollingFile name="fileAppender" fileName="${logName}"
                 append="true" filePattern="${logName}.%d{yyyy-MM-dd-a}">
                 <PatternLayout
                       pattern="[%d{DEFAULT}]:[%-5p]:[%15c{1}]:[%15t] - %m%n" />
                 <Policies>
                       <TimeBasedTriggeringPolicy interval="1"
                              modulate="true" />
                 </Policies>
          </RollingFile>

推荐答案

您可以尝试使用 CronTriggeringPolicy 吗?

Can you try using the CronTriggeringPolicy?

这篇关于将RollingFlie Appender配置为在每天的午夜和中午进行过渡的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆