Error log4netERROR NHibernateProfilerAppender Attempted to append to closed appender named NHibernateProfiler
NHprofiler de facto is THE TOOL to work with NHibernate, :)
If you work with NHibernate you must have NHProf, if you use it for 1 minute you can never work without it in the future, period. :)
I started today to use NHProf even for unit testing, since I want to be able to look at generated sql during tests of entities. I have a base test infrastructure to work with helper, so I have this snippet of code in fixture setup.
|
|
When I run the unit test I see that session initialization data will shown in nhibernate profiler ui, but the test then throws a
log4net:ERROR [NHibernateProfilerAppender] Attempted to append to closed appender named [NHibernate.Profiler]
This happens because NhProfiler uses log4net to intercept nhibernate calls, and it seems that someone closes the appender before nhprof has finished collecting data. This error happens because you need to configure log4net before the call to
|
|
If you like me use the Castle Log4Net faciliy, you simply need to be sure that the facility configures log4net before starting nhprofiler
|
|
In my situation the act of resolving an ILogger makes me sure that log4net is completely configured before I started nhprofiler appender and everything works well.
alk.