I have the following Fluent Nhibernate configuration:
public ISessionSource CreateSessionSource()
{
开发者_运维知识库 var config = Fluently.Configure()
.Database(MsSqlCeConfiguration
.Standard
.ConnectionString(connectionString)
.DoNot.ShowSql()
.UseOuterJoin()
.UseReflectionOptimizer())
.Mappings(GetMappings)
.Diagnostics(x => x.Enable(false))
.ExposeConfiguration(ExposeConfiguration);
Factory.RegisterSingleton(config);
var source = new SessionSource(config);
return source;
}
I had understood that the .Diagnostics(x => x.Enable(false)) would prevent logging but I am still getting the entire DEBUG,INFO,ERROR,FATAL levels logged to my log4net appenders.
Any pointers or help would be appreciated.
Thanks
As I understand it, the Diagnostics method controls Fluent NHibernate's logging level, not NHibernate's. The log4net logging level for NHibernate should be set in your config file:
<log4net>
<root>
<appender-ref ref="SqlServerAppender" />
<level value="ERROR" />
</root>
<logger name="NHibernate">
<level value="ERROR" />
</logger>
<!-- etc -->
</log4net>
精彩评论