差異處
這裏顯示兩個版本的差異處。
Both sides previous revision 前次修改 下次修改 | 前次修改 | ||
java:log4j2:timeandsizerollingappender [2022/04/10 22:59] tony |
java:log4j2:timeandsizerollingappender [2023/06/25 09:48] (目前版本) |
||
---|---|---|---|
行 55: | 行 55: | ||
appender.logfile.strategy.action.ifAccumulatedFileCount.exceeds = 10 | appender.logfile.strategy.action.ifAccumulatedFileCount.exceeds = 10 | ||
</code> | </code> | ||
- | 目前實驗起來上面設定等價於,代表最上層是屬於and的關係: | + | 根據文件描述與目前實驗起來,上面的關係是屬於IfAll的關係。另外記錄一下,目前我們使用的log4j2版本為2.17.2,我發現當設定下面兩組properties時,雖然合理但其實沒有作用。第一組是把key從ifFileName改成IfFileName: |
+ | <code properties> | ||
+ | appender.logfile.strategy.action.IfFileName.type = IfFileName | ||
+ | appender.logfile.strategy.action.IfFileName.glob = log.txt* | ||
+ | appender.logfile.strategy.action.ifAccumulatedFileCount.type = IfAccumulatedFileCount | ||
+ | appender.logfile.strategy.action.ifAccumulatedFileCount.exceeds = 10 | ||
+ | </code> | ||
+ | 第二組是在最上層設定了IfAll是沒有作用的.. | ||
<code properties> | <code properties> | ||
appender.logfile.strategy.action.ifAll.type = IfAll | appender.logfile.strategy.action.ifAll.type = IfAll | ||
行 63: | 行 70: | ||
appender.logfile.strategy.action.ifAll.ifAccumulatedFileCount.exceeds = 10 | appender.logfile.strategy.action.ifAll.ifAccumulatedFileCount.exceeds = 10 | ||
</code> | </code> | ||
- | 要怎麼用,就看你個人需求為何了。 | + | 這就不曉得log4j2是否存在某種潛規則了.. |
===== Reference ===== | ===== Reference ===== | ||
* [[https://www.cnblogs.com/yeyang/p/7944899.html|Log4j2中RollingFile的文件滚动更新机制]] | * [[https://www.cnblogs.com/yeyang/p/7944899.html|Log4j2中RollingFile的文件滚动更新机制]] |