Log4net 日志记录配置信息
<log4net> 8 <!--配置日志的级别,低于此级别的就不写到日志里面去 9 OFF、FATAL、ERROR, WARN, INFO, DEBUG, ALL 10 --> 11 <root> 12 <level value="DEBUG" /> 13 <appender-ref ref="LogFileAppender" /> 14 <appender-ref ref="ConsoleAppender" /> 15 </root> 16 17 <logger name="WebLogger"> 18 <level value="ERROR" /> 19 </logger> 20 21 <!--输出到文件--> 22 <appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender,log4net"> 23 <param name="File" value="Log/" /> 24 <param name="AppendToFile" value="true" /> 25 <!-- 切割最多文件数 -1表示不限制产生日志文件数--> 26 <param name="MaxSizeRollBackups" value="-1"/> 27 <!-- 每个文件的大小限制 --> 28 <param name="MaximumFileSize" value="10MB"/> 29 <!-- RollingStyle Composite 综合 Size 按大小 Date 按时间 --> 30 <param name="RollingStyle" value="Composite" /> 31 <param name="DatePattern" value=""Logs_"yyyyMMdd".txt"" /> 32 <param name="StaticLogFileName" value="false" /> 33 <layout type="log4net.Layout.PatternLayout,log4net"> 34 <param name="Header" value="
----------------------application startup--------------------------
" /> 35 <param name="Footer" value="
 ----------------------application shutdown--------------------------
" /> 36 <param name="ConversionPattern" value="%d [%t] %-5p %c - (%line) %m%n" /> 37 </layout> 38 39 <filter type="log4net.Filter.LevelRangeFilter"> 40 <param name="LevelMin" value="ALL" /> 41 <param name="LevelMax" value="OFF" /> 42 </filter> 43 </appender> 44 45 <!--输出控制台--> 46 <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender,log4net"> 47 <layout type="log4net.Layout.PatternLayout,log4net"> 48 <param name="ConversionPattern" value="%d [%t] %-5p %c - (%line) %m%n" /> 49 </layout> 50 </appender> 51 52 </log4net>