How can I disable Log4Net logging for Active Record...?
<configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,Log4net"/>
</configSections>
<log4net debug="false">
<root>
<level value="DEBUG" />
<appender-ref ref="LogFileAppender" />
</root>
<appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender" >
<param name="File" value="C:\Projects\MyProject\bin\Log.txt" />
<param name="AppendToFile" value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="10MB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="%-5p%d{yyyy-MM-dd hh:mm:ss} – %m%n" />
</layout>
</appender>
</log4net>
Global.asax.cs
XmlConfigurationSource source = new XmlConfigurationSource("C:\Projects\MyProject \\ActiveRecord.xml");
ActiveRecordStarter.Initialize(source, typeof(User), typeof(Role));
log4net.Config.XmlConfigurator.Configure();
log.Info("Application Started");
If you want to disable logging completely then you can turn logging off on the root logger.
If you want to disable only for Active Record you need to find out the namespace that Active Record is using (or if they did not follow this convention the logger name that Active record is using).
If it is about NHibernate then the following configuration does the trick: