用log4net記錄日志,幾個(gè)關(guān)鍵點(diǎn)需要注意。

?


1、配置文件APP中,該?<startup>......<startup>必須在Log4Net配置后面。圖一所示
2、需定義一下字段:?public static readonly ILog log =?LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);?圖二所示
3、?log4net.Config.XmlConfigurator.Configure();//必須增加該行,否則無法寫入事件到本地log4net文本中。圖三所示
標(biāo)簽: