Log4net:在utc日期而不是服务器日期滚动文件 [英] Log4net : Rolling file on utc date rather than server date

查看:93
本文介绍了Log4net:在utc日期而不是服务器日期滚动文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有办法使log4net在utc时间而不是服务器时间上滚动文件?现在,我的文件以utc时间存储日志.但是它会翻转,即在服务器时间的每一天都创建一个新文件.服务器的时间是太平洋时间,因此发生的情况是昨天的文件具有今天文件的前8个小时的日志.

Is there a way to make log4net roll over the file on utc time rather than server time? Right now my file stores logs in utc time. But it rolls over, i.e. creates a new file for each day on server time. The server is on Pacific time, so what happens is that yesterdays file has the first 8 hours of logs from todays file.

例如10月11日的文件的日志一直记录到11月11日上午7:59:59.

E.g. File for Nov-10 has logs until 07:59:59 am of Nov-11.

如何根据utc时间使log4net翻转文件?

How do I make log4net roll over the file depending upon utc time?

推荐答案

扩展现有的Appender之一,并重新实现进行重新组合的代码.应该不太难.

Extend one of the existing Appenders and reimplement the code that does the reolling over. Shouldn't be too hard.

这篇关于Log4net:在utc日期而不是服务器日期滚动文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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