每周通过rollingFileAppender记录日志-log4net [英] logging each week via rollingFileAppender--log4net

查看:149
本文介绍了每周通过rollingFileAppender记录日志-log4net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一种解决方案,可以通过RollingFileAppender的datePattern每周创建一次日志文件?我知道yyyyMMdd对于每一天都是有效的,但是我找不到每周记录的解决方案.预先感谢.

is there a solution to make the log files be created each week by RollingFileAppender's datePattern? I know that yyyyMMdd is valid for each day but i couldn't find a solution for weekly logging. thanks in advance.

推荐答案

据我所知,您需要为此编写自己的附加程序. .Net自定义格式字符串没有任何可用于获取日历周的内容.不过有一个API:

As far as I can tell you need to write your own appender for this. The .Net custom format strings do not have anything for getting the calendar week. There is an API for that though:

http://msdn.microsoft.com/zh-CN/library/system.globalization.calendar.getweekofyear%28VS.71%29.aspx

这篇关于每周通过rollingFileAppender记录日志-log4net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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