主要步骤: 1.下载从开源网站下载获取dll文件log4net.dll; http://logging.apache.org/log4net/download_log4net.cgi 2.建立c# winform项目,名称为logTest; 3.添加配置文件log.config; 4.添加按钮代码; private void button1_Click(object sender, EventArgs e) { log4net.Config.XmlConfigurator.Configure(new FileInfo("log.config"));