禁用NHibernate日志记录 [英] Disable NHibernate logging

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

问题描述

我有一个 app.config文件,但是我仍然收到NHibernate调试日志

I have an empty app.config file, but I still get NHibernate debug logs

NHibernate: SELECT this_.LogID as LogID71_0_, this_.Level as Level71_0_, this_.Message as Message71_0_, this_.EventTime as EventTime71_0_, this_.Component as ...

我尝试添加具有错误日志级别的log4net配置,但是没有用.如何停止这些日志消息?

I tried adding a log4net configuration with an ERROR log level, but no use. How can I stop these log messages?

令我困惑的是,如果我有一个空的app.config,为什么它们会首先出现.对我而言,我必须对其进行配置以使其不打印这些消息没有意义-默认应为关闭状态.难道是我的代码以某种方式将它们设置为打开状态?我应该找什么?

The thing I'm puzzled about is why do these appear in the first place if I have an empty app.config to being with. It doesn't make sense to me that I have to configure it not to print these messaages - the default should be off. Could it be my code is setting them on programatically somehow? What should I look for?

推荐答案

您需要同时拥有这两个记录器:

You need to have both these loggers:

 <logger name="NHibernate">
   <level value="ERROR" />
 </logger>

 <logger name="NHibernate.SQL">
   <level value="ERROR" />
 </logger>

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

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