Skip to content

Instantly share code, notes, and snippets.

@dalager
Created February 24, 2011 12:22
Show Gist options
  • Save dalager/842106 to your computer and use it in GitHub Desktop.
Save dalager/842106 to your computer and use it in GitHub Desktop.
log4net.config
<?xml version="1.0" encoding="utf-8"?>
<log4net debug="false">
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="Logs/Debug.log" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="1000KB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%d [%t] %-5p %c - %m%n" />
</layout>
</appender>
<appender name="ErrorLog" type="log4net.Appender.RollingFileAppender">
<file value="Logs/Errors.log" />
<filter type="log4net.Filter.LevelRangeFilter">
<levelMin value="ERROR" />
<levelMax value="FATAL" />
</filter>
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="1000KB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%d [%t] %-5p %c - %m%n" />
</layout>
</appender>
<appender name="NHibernateErrors" type="log4net.Appender.RollingFileAppender">
<file value="Logs/NHibernateErrors.log" />
<appendToFile value="true" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="1000KB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%d [%t] %-5p %c - %m%n" />
</layout>
</appender>
<appender name="SecurityLog" type="log4net.Appender.RollingFileAppender">
<file value="Logs/Security.log" />
<appendToFile value="false" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="1000KB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%d - %m%n" />
</layout>
</appender>
<appender name="NHibernateSqlRollingFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="Logs/NHibernate.Sql.log" />
<appendToFile value="false" />
<rollingStyle value="Size" />
<maxSizeRollBackups value="10" />
<maximumFileSize value="1000KB" />
<staticLogFileName value="true" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%d [%t] - %m%n" />
</layout>
</appender>
<appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%d [%t] %-5p %c - %m%n" />
</layout>
</appender>
<appender name="OutputDebugStringAppender" type="log4net.Appender.OutputDebugStringAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%-5p %m - %c -%n" />
</layout>
</appender>
<appender name="TraceAppender" type="log4net.Appender.TraceAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%d [%t] %-5p %c - %m%n" />
</layout>
</appender>
<root>
<level value="debug" />
<appender-ref ref="RollingFileAppender" />
<appender-ref ref="OutputDebugStringAppender" />
<appender-ref ref="ConsoleAppender" />
</root>
<!-- this is an example of how to apply a filter to a specific class saying:
"for this class only log from this level"
-->
<logger name="Datalayer.Impl.HybridSessionBuilder">
<level value="WARN" />
</logger>
<logger name="NHibernate" additivity="false">
<level value="ERROR"/>
<appender-ref ref="NHibernateErrors" />
<!--<appender-ref ref="OutputDebugStringAppender" />-->
<!--<appender-ref ref="ConsoleAppender" />-->
</logger>
<logger name="FluentNHibernate" additivity="false">
<level value="WARN"/>
<appender-ref ref="ErrorLog" />
</logger>
<logger name="NHibernate.SQL" additivity="true">
<level value="ERROR"/>
<appender-ref ref="NHibernateSqlRollingFileAppender" />
<!--<appender-ref ref="OutputDebugStringAppender" />-->
<!--<appender-ref ref="ConsoleAppender" />-->
</logger>
</log4net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment