WPF写的一个使用Log4net.dll库的demo
代码存放在:http://download.csdn.net/detail/leolinsheng/9410946
1.引入库log4net.dll
2.在AssemblyInfo.cs中添加一行:
[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", ConfigFileExtension = "config", Watch = true)]
- 3.添加log4net.config配置文件:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="log4net" type="System.Configuration.IgnoreSectionHandler"/>
</configSections>
<log4net>
<appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="log\logfile.log"/>
<appendToFile value=