log4net使用的关键点
<configSections>
< section name =" log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net" />
</configSections>
<log4net>
< appender name =" UpdateManagementClientLogFileAppender" type="log4net.Appender.FileAppender" >
< file type =" log4net.Util.PatternString" value="UpdateManagementClient.log" />
< appendToFile value =" true" />
< rollingStyle value =" Size" />
< maximumFileSize value =" 10MB" />
< maxSizeRollBackups value =" 10" />
< layout type =" log4net.Layout.PatternLayout">
< conversionPattern value =" %date [%thread] %-5level - %message%newline" />
</ layout>
</ appender>
< root>
< level value =" ALL" />
< appender-ref ref =" UpdateManagementClientLogFileAppender" />
</ root>
</log4net>
AssemblyInfo.cs
[assembly: XmlConfigurator(Watch = true)]
private static readonly ILog Log = LogManager.GetLogger(MethodBase .GetCurrentMethod().DeclaringType);
Log.Info("test").
作者:Jackhuclan
出处:http://jackhuclan.cnblogs.com/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。
出处:http://jackhuclan.cnblogs.com/
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。