How do I configure NHibernate Profiler so I can enable/disable it without changing code? [closed]

吃可爱长大的小学妹 提交于 2019-12-11 07:51:56

问题


I've been trying to follow the directions on the NHProf site but can't seem to make it work. What am I missing?

I put a log4net configuration section in my web.config:

<configSections>
  <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net/>
  ...
</configSections>
...
<log4net>
  <appender name="NHProfAppender" type="HibernatingRhinos.Profiler.Appender.NHibernate.NHProfAppender, HibernatingRhinos.Profiler.Appender">
    <sink value="http://localhost:22897"/>
  </appender>
  <logger name="HibernatingRhinos.Profiler.Appender.NHibernate.NHProfAppender.Setup">
    <appender-ref ref="NHProfAppender"/>
  </logger>
<log4net>

And in Global.asax:

protected void Application_Start(...)
{
  ...
  log4net.Config.XmlConfigurator.Configure();
  ...
}

The HibernatingRhinos.Profiler.Appender.dll assembly is in my bin\ directory, but so far no dice. I've been able to verify that a log4net logger is being created with the right name, but I don't believe that an appender is associated with it. Any ideas?


回答1:


I must have had a typo somewhere, because now everything's working. So I guess I was doing it correctly after all.




回答2:


I would check to ensure NHProf is using the port you think it is using (22897). Tools/Options, I believe.



来源:https://stackoverflow.com/questions/2366008/how-do-i-configure-nhibernate-profiler-so-i-can-enable-disable-it-without-changi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!