【发布时间】:2011-06-07 22:36:06
【问题描述】:
我正在考虑切换到新的统一日志记录解决方案以用于我们的新产品线,我想看看 Stack Overflow 上的一些人是怎么想的。我们需要记录各种应用程序:ASP .net、Windows 服务、Web 服务、wpf 应用程序等。我们只是一家 Windows 商店。
我们对日志记录解决方案的一些要求包括:
1) 日志文件管理
- Ability to split files up over a certain size
- Ability to auto archive/delete after certain period of time
2) 能够针对记录的某些类型的消息(例如错误)发送电子邮件
3) 能够将消息写入 Windows 事件日志
- We need to be able to specify where it's being written in the event log.
It would also be nice if it would automatically create the event log source if it does exist.
我已经开始研究 nLog、windows trace 和 log4net。我不限于这三个,只是搜索时出现了很多。
【问题讨论】:
-
log4net 是迄今为止最常用的一种,并且支持所有这些要求。这是我会使用的,但 YMMV。
-
试试这个:stackoverflow.com/search?q=[.net]+logging 你会发现很多有趣的答案。
-
重复,但Cole W确实提出了他想到的一些具体要求,这对这个问题很好。