是否可以将log4net配置为在错误时发出通知? [英] Is it possible to configure log4net to make notification on error?

查看:90
本文介绍了是否可以将log4net配置为在错误时发出通知?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我重新表述了这个问题,以避免将C#异常作为例外.

根据设计,log4net是静音工具,或者如FAQ所述,它是故障停止系统.

By design log4net is silent utility, or as FAQ describes it as fail-stop system.

但是这种行为与我所需要的相反.我需要这个:

However such behaviour is opposite to what I need. And I need this:

  • 错误的配置-通知事件
  • 缺少数据库提供程序-通知事件
  • 无法登录数据库-通知事件

以此类推.

那么是否有可能(如果是,怎么办?)配置log4net来发出错误通知,而不是默默地忽略它?

So is it possible (and if yes, how?) to configure log4net to make a notification on error instead of silently ignoring it?

推荐答案

您是否在谈论log4net内部调试?

Are you talking about log4net internal debugging?

您可以按以下说明启用它: http://logging.apache.org/log4net/release/faq.html#trouble-file-perm .

You can enable this as described here: http://logging.apache.org/log4net/release/faq.html#trouble-file-perm.

这将确保也记录内部log4net异常.

This will make sure that inernal log4net exceptions are logged too.

编辑,log4net可以在运行时引发异常吗? 不. log4net不可靠.这是一种尽力而为的故障停止记录系统.通过故障停止,我们意味着log4net不会在运行时引发意外异常,从而可能导致您的应用程序崩溃.请参见

EDIT Can log4net throw exceptions at run time? No. log4net is not reliable. It is a best-effort and fail-stop logging system. By fail-stop, we mean that log4net will not throw unexpected exceptions at run-time potentially causing your application to crash. See http://logging.apache.org/log4net/release/faq.html.

这篇关于是否可以将log4net配置为在错误时发出通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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