登录使用的InnerException log4net的 [英] Logging InnerException using Log4Net

查看:211
本文介绍了登录使用的InnerException log4net的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何记录与log4net的?

内部异常

这是我目前的转换方法:

 < conversionPattern值=%DATE [%的AppDomain]%-5level%记录[%属性{NDC}]  - %消息%换行/>
 

解决方案

控制台和文件附加目的地自动打印例外。唯一的例外:消息,堆栈跟踪,以及所有内部异常(再次堆栈跟踪)登录不同的线,也不要跟随转换模式

我甚至不知道你可以配置log4net的不打印。

更新:的 它可以配置附加器不打印栈跟踪: <一href="http://stackoverflow.com/questions/3659271/log4net-logging-out-the-exception-stacktrace-only-for-certain-files/3660529#3660529">Log4Net - 注销异常堆栈跟踪仅适用于特定的文件

How do I log inner exception with Log4NET?

This is my current conversion pattern:

<conversionPattern value="%date [%appdomain] %-5level %logger [%property{NDC}] - %message%newline" />

解决方案

Console and File Appenders automatically print the exception. The exception: message, stack trace, and all inner exceptions (again with stack trace) are logged on separate lines and do not follow the conversion pattern.

I am not even sure if you could configure log4net not to print it.

Update: It is possible to configure the appender to not print the stacktrace: Log4Net - Logging out the Exception stacktrace only for certain files

这篇关于登录使用的InnerException log4net的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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