I am trying to activate logging in my application using Fluent NHibernate and log4net. I tried the ones described here here , here , here and here . A log file is created, but nothing is written to it. In the other log files for this and other applications, all seams work fine, so I assume the problem is with my configuration.
Here is the code I put in to try to get this to work:
A section of the configuration file with all the parameters of my log4net related to this APP:
<appender name="RollingFileAppenderNHibernate"
type="log4net.Appender.RollingFileAppender">
<file value="C:\temp\RollingLogFileNHibernate" />
<appendToFile value="true" />
<ImmediateFlush value="true" />
<rollingStyle value="Date" />
<DatePattern value="yyyyMMdd.\l\o\g" />
<StaticLogFileName value="false" />
<MaxSizeRollBackups value="1" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
</layout>
</appender>
<logger name="NHibernate.SQL"
additivity="false">
<level value="ALL"/>
<appender-ref ref="RollingFileAppenderNHibernate"/>
</logger>
My NHibernate configuration:
public static ISessionFactory CreateSessionFactory()
{
return Fluently.Configure()
.Database(OracleClientConfiguration.Oracle10
.ConnectionString((conn =>
conn.FromConnectionStringWithKey("APPDB")))
.ShowSql())
.Mappings(m =>
m.FluentMappings.AddFromAssemblyOf<{ObjectName}>())
.BuildSessionFactory();
}
In Application_Start () of my Global.asax.cs:
log4net.Config.XmlConfigurator.Configure();
, , .