使用log4net的以及在哪里实现它,并使用ELMAH? [英] Using log4net and where to implement it and using with elmah?

查看:182
本文介绍了使用log4net的以及在哪里实现它,并使用ELMAH?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人有log4net的经验,我一直在寻找ELMAH这是伟大的。但我想多一点控制,即使用日志记录不仅在asp.net而且在WPF。

does anyone have experience with log4net, i have been looking at elmah which is great. But i wanted a little bit more control i.e. to use logging not only in asp.net but also in wpf.

安韦我决定看看log4net的。

Anway i decided to take a look at log4net.

我有2个客户端,(WPF和asp.net)这两个份额的业务逻辑。

I have 2 clients, (wpf and asp.net) that both share business logic.

我应该在提高业务逻辑,并在客户端也??

Should i be raising events in business logic and in the client also ??

我presume业务逻辑将使用的app.config / web.config中(业务逻辑是在另一个层 - 一类项目)

I presume the business logic will use the app.config / web.config (business logic is in another layer - a class project)

在一起有没有人使用log4net的使用ELMAH,反正是有,你可以让他们共享同一个数据库表??

Has anybody used log4net together with elmah, is there anyway you can get them to share the same db table??

log4net的在我看来,最终的日志框架,但有ELMAH提交所有的服务器变量的边缘和堆栈跟踪等。

log4net seems to me the ultimate logging framework but elmah has that edge of submitting all the SERVER variables and stack trace etc

或者,也许它可能获得log4net的保存堆栈跟踪也并完全取代ELMAH?

OR maybe its possible to get log4net to save the Stacktrace also and replace elmah completely??

任何意见真的AP preciated

Any comments really appreciated

推荐答案

他们用于两种不同的目的。

They're used for two different purposes.

ELMAH用于捕获和存储您的例外,没想到的。它也提供了用于递送例外几前端(网页,RSS电子邮件报警器)。

Elmah is used to catch and store the exceptions that you did not expect. It also provides a few front ends (web page, RSS, email alerter) for delivering the exceptions.

log4net的,另一方面是记录事件(的包括的引起异常错误)(否则你不会有一个try / catch块),你有种就知道可能发生。

Log4net on the other hand is for logging events (including errors caused by exceptions) that you kind of knew could happen (otherwise you would not have a try / catch block).

因此​​,你应该同时使用,而不是一方或另一方。

Therefore, you should use both, not one or the other.

要回答你的具体问题,你的可以的GET log4net的登录异常的堆栈跟踪,但你不应该普遍日志,你记录每个调试消息堆栈跟踪。日志服务器变量和其他特定网页的东西也是可以的,但需要你不想做一些定制的编码。

To answer your specific question, you can get log4net to log stacktrace of exception, but you should not generally log stack trace for every debug message that you log. Logging server variables and other web-specific stuff is also possible, but will require some custom coding which you don't want to do.

这篇关于使用log4net的以及在哪里实现它,并使用ELMAH?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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