开发环境:win7+vs2010+VB.net+.net4.0
1.下载log4net (http://logging.apache.org/log4net/)
2.新建类库类项目
3.添加log4net.dll
4.添加新项log4net的XML配置文件,例如起名为:OracleLog4Helper.config,编写内容如下:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<!-- Register a section handler for the log4net section -->
<configSections>
<section name="log4net" type="System.Configuration.IgnoreSectionHandler" />
</configSections>
<log4net>
<!-- the rollingFile Appender, which could save log to File ,and according to the configuration, when the file reach 100kb, it will save the old file to the TestLog4Net.log.1, and the TestLog4Net.log.2 and that's all-->
<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">