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="true"/>
<

这篇博客展示了如何在WPF项目中使用Log4net.dll库进行日志管理。内容包括引入库、配置文件设置、创建日志管理类以及在代码中调用日志功能的步骤。作者特别提醒,项目命名避免与库名冲突,以免导致错误。

5211

被折叠的 条评论
为什么被折叠?



