首页 > 代码库 > log4net使用的关键点
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").
log4net使用的关键点
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。