问题
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