为什么Nhibernate需要Log4Net? [英] why do you need Log4Net for nhibernate?

查看:65
本文介绍了为什么Nhibernate需要Log4Net?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将使用asp.net mvc3和nhibernate 3.2构建我的应用程序.我决定使用Elmah记录所有错误消息.

I am going to build my application using asp.net mvc3 and nhibernate 3.2. I decided to use Elmah to log all the error messages.

我记得nhibernate支持log4net并使用它来记录所有查询.如果我不关心将查询输出到日志文件,可以使用nhibernate profiler进行此操作,还有什么其他原因会阻止我从log4net切换到Elmah?

I remember nhibernate supports log4net and use it to log all queries. If I dont care about outputting the queries to the log file, I can use nhibernate profiler to do that, what other reasons will stop me swtiching from log4net to Elmah?

推荐答案

好吧,无论您是否积极使用NHibernate的日志记录功能,NHibernate库的代码都依赖于log4net,因此您将需要使用log4net DLL.可用于NHibernate以便加载NHibernate DLL.您只能通过下载 NHibernate 源代码并修改它以删除 log4net 的使用(完全剥离日志记录功能或用 Elmah 替换它)来解决此问题.

Well, whether you actively use the logging abilities of NHibernate or not, the NHibernate library's code has dependencies on log4net, and so you will need to have the log4net DLL available to NHibernate in order to load the NHibernate DLL. You can only get around this by downloading the NHibernate source and modifying it to remove uses of log4net (either stripping out the logging capability entirely or replacing it with Elmah).

这就是为什么通常来说,您必须注意使用什么库来开发自己的代码,因为使用的库越多,应用程序就越需要,即使用户从未真正使您的应用程序执行一个程序所引用的代码行.

This is why, in general, you must be careful what libraries you use to develop your own code, because the more you use, the more your app will need, even if the user never actually causes your app to execute a single line of the referenced code.

这篇关于为什么Nhibernate需要Log4Net?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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