log4net-RollingFileAppender自定义文件名 [英] log4net - RollingFileAppender customize file name

查看:96
本文介绍了log4net-RollingFileAppender自定义文件名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您将文件名配置为"test.txt"时,log4net将写入以下文件名:
test.txt,test.txt.1,test.txt.2等.
我需要这样的文件名:
test_000001.txt,test_000002.txt,test_000003.txt等.
任何想法该怎么做?

When you configure the file name to be "test.txt" log4net will write files with names:
test.txt, test.txt.1, test.txt.2 and so on.
I need the file names in this way:
test_000001.txt, test_000002.txt, test_000003.txt and so on.
Any idea how to do that?

推荐答案

您可能正在寻找的是 ^ ].它是Rolling File Appender的补丁,用于保留具有静态文件名的文件扩展名.
What you may be looking for is this[^]. It is a patch to the Rolling File Appender to preserve file extensions with static file names.


好吧,我仍然没有确切的解决方案,但是现在更好了.
我所做的是:使用log4net.dll 1.2.11.0.在配置文件中设置
PreserveLogFileNameExtension值="true".
文件名是test.txt,test.1.txt,test.2.txt等.
Well, I still do not have the exact solution, but it is better now.
What I did is: Use log4net.dll 1.2.11.0. Set in the config file
PreserveLogFileNameExtension value ="true".
The file names are test.txt, test.1.txt, test.2.txt and so on.


这篇关于log4net-RollingFileAppender自定义文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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