开发者

Why does this Fluent NHibernate Configuration still log all levels to log4net?

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>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜