1、引入log4net.dll

1.1 Nuget安装 或 http://logging.apache.org/log4net/下载log4net的源代码,编译后把log4net.dll引入项目。

2、配置log4net.config

2.1 在Web.config文件中进行添加configSections的节点

  <configSections>
<section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
</configSections>

2.2 添加log4net.config(设置为始终复制到输出目录)

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<log4net>
<!-- 信息日志类 -->
<logger name="loginfo">
<level value="ALL" />
<appender-ref ref="InfoAppender" />
</logger> <!-- 信息日志附加介质 -->
<appender name="InfoAppender" type="log4net.Appender.RollingFileAppender">
<!-- 输出到什么目录 -->
<param name="File" value="Log\\LogInfo\\" />
<!-- 是否覆写到文件中 -->
<param name="AppendToFile" value="true" />
<!-- 备份文件的个数 -->
<param name="MaxSizeRollBackups" value="50" />
<!-- 单个日志文件最大的大小 -->
<param name="MaxFileSize" value="10240" />
<!-- 是否使用静态文件名 -->
<param name="StaticLogFileName" value="false" />
<!-- 日志文件名 -->
<param name="DatePattern" value="yyyyMMdd&quot;.htm&quot;" />
<param name="RollingStyle" value="Date" />
<!-- 布局,更多参数可参照官网说明 -->
<layout type="log4net.Layout.PatternLayout">
<param name="ConversionPattern" value="&lt;HR COLOR=red&gt;
%n级别:%-5p &lt;BR&gt;
%n时间:%d [%t] &lt;BR&gt;
%n描述:%m &lt;BR&gt;"/>
</layout>
</appender>
</log4net>
</configuration>

2.3 在AssemblyInfo.cs文件中指定配置log4net.config

[assembly: log4net.Config.XmlConfigurator(ConfigFile = "log4net.config", ConfigFileExtension = "config", Watch = true)]

2.4 若项目为B/S结构,还需在Global.asax文件中添加如下配置

log4net.Config.XmlConfigurator.Configure();

3、代码使用示例

3.1 封装工具类LogHelper

namespace July.Demo.Win
{
public class LogHelper
{
static readonly log4net.ILog loginfo = log4net.LogManager.GetLogger("loginfo"); public static void WriteLog(string info)
{
if (loginfo.IsInfoEnabled)
{
loginfo.Info(info);
}
}
}
}

3.2 使用示例

private void Form1_Load(object sender, EventArgs e)
{
LogHelper.WriteLog("窗体生成");
}

4、运行结果

4.1 效果图如下

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAikAAADKCAIAAADvvkdMAAAeL0lEQVR4nO2dyVbbSPuHdRfcAxsWXES2vWHJxveQNWtvuIDv6wz86XQnTggGYjJCZoaEDICBmDE0kyEYaCDpxuQ7+i+M7ZJqUMmWBek8z3kPxxalt15VSfVTDZac7cMihmEYhsVpTv6vosG2Dk4WNw8mPq2NTC0/fzf/5M3skzezzyZyI1PLE5/W5tf3tw5OzB4wDMMwzGfO9uGp0jb2/v4wvzH0Zu7d3NrS5v7W/t87hyeF49PC8enO4cnW/t/LWwfv5taG3sy9z61v7P2t84NhGIZhPnPyf536bOvgdHIx/2xi/tPq7pej073j7wb7clScXys8nchNLua3DvyuMAzDMEw2Z+uvomhL+cPxmdWPC5vbf/2ze3xqaduHJx8XNsdnVpfyhxv7//h8YhiGYZhoztZBsWIr20fPJnK5tcKXw2Lh6DSUfTkszq/tvXi/0PPoTf+z9wPPP2AYhmGY0pytv05LtpQ/ejW5vLR1sHv8vWb7vH00/Wnp4PDoOwAAgIYz7fmz8Pf4zJ+f1gr1CE/Jdgr7i5/XT4qnLgAAgApn86C4eVD8uLj1Prfx5ei0fvt68r/V9fzm9u55HxoAAFxQnI2D4mL+aCT7efXL8c7RaaC9mV6cmFkyJNg9Pt07/Lrwef3rt7/P++gAAOAi4mwenE7kNrIrO1+Ovgfa8OjHK7+nf/09PfL+kyHZ3tf/bX8p/Lm5rcv127dvMzMzw8PDAwMDAwMDw8PDMzMz3759i/PIAQDgvHBWd/8enljY3D/ZOfputuHRj9dTmZv9Q3/0P7l6s3/n6NSQ+K9vxenccvFUMeuzvr5+7969kZGR9+/fz87Ovn//fmlpqa+vb2BgYG1tLf4iAACAmHFmVvfezK4F/gZ1aPTD9dS9W/ee3nnw8ubA8PjUgjn97vH3lbWtvYNDX35ra2v379/f2dk5Ojr68OHDwMBAf3//69eve3t7B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A3KA9AAAQN2rtMSxms1w70KAlBvZuQ63Hqy2lvBcLKwAAbIhAe5QNbuPa4trEz2YteCj/Og/IDwBAIAHa4+hRpld6qCs+a3QB2IQRofYAAEAg0Yy51fC7H0sMGmaIKmw8obSnNi0EAIAKiqfdyA2oZdMceUMsB6DUGJ3SWMYTVkiUh4PYAADYY9XvCe20MTf+lj6VuZslM1QuaA8AQJ0Ea4+hHxDYk9BkGvxUY6U3m06Jq9IeQzyhVMqQwLHrGgIAgGvWHsc7oiV/8KU37OsltPYoPyu3KPM1qJQ5O108Shm29wAA8JOj1R6D5NhrjzJx6BA1nTBd1oZ4bIIJ1e9BewAAakB9429uXg3a04i22F5mlDkGao9uKM+mt2QQXQAA0KEYm3Kt53vENPJeys+1hCiJR6DzUJ023b42CdAeAIAasFproPugTK/bUjM+V+av4sbKX59qmmOrWXvcMAoHAPAzcy7aU+9aA5t+Tw2KFfgvOQa5g2jpBADgZyYC7Qk/1lSj9piH18wb7cOz7xUZSgntAQAwYDVzY5jvCUwp7xI6xCCUuwRusfEs52KTXZ3HCwDwr8eqJTUnaDTm7OrRnkgisd8IAAAlaCIBACBu0B4AAIgbtAcAAOIG7QEAgLhBewAAIG7QHgAAiBu0BwAA4gbtAQCAuEF7AAAgbtAeAACIG7QHAADi5v8B6ba5mrGqKNgAAAAASUVORK5CYII=" alt="" />

欢迎转载,但请注明出处:http://www.cnblogs.com/julyweb/,谢谢!

(一)使用log4net生成日志文件的更多相关文章

  1. 使用log4net生成日志文件

    (一)使用log4net生成日志文件   1.引入log4net.dll 1.1 Nuget安装 或 http://logging.apache.org/log4net/下载log4net的源代码,编 ...

  2. log4j自动生成日志文件配置

    生成文件到默认位置: #生成日志文件 #log4j.appender.systemFile=org.apache.log4j.RollingFileAppender #按天生成 log4j.appen ...

  3. NGINX按天生成日志文件的简易配置

    NGINX按天生成日志文件的简易配置 0x01 最近后端童鞋遇到一个小需求,拆分nginx生成的log文件,最好是按天生成,看着她还有很多bug待改的状态,我说这个简单啊,我来吧.曾经搞node后端的 ...

  4. SpringBoot日志配置(详解) 涉及控制台输出日志、生成日志文件、日志级别修改、hibernate日志不输出

    写在前面 本篇主要讲述日志配置,看完本篇可以解决下述问题, 控制台输出日志.生成日志文件.日志级别修改.hibernate日志不输出 Git Demo Path:https://github.com/ ...

  5. 【spring boot logback】日志logback 生成日志文件在本项目下,而不在指定的日志文件目录下/指定日志文件到达最大值后不按照配置进行切割

    原本的日志文件配置如下: <?xml version="1.0" encoding="UTF-8"?> <configuration scan ...

  6. Flask log配置,实现按照日期自动生成日志文件

    Flask自带了logger模块,用来方便程序员群众记录日志,这里粘贴出来的是一段代码,用来初始化日志各项配置参数,并根据日期自动生成日志文件. #log配置,实现日志自动按日期生成日志文件def m ...

  7. C# 开发 Windows 服务 使用Log4net 组件 不能生成日志文件

    使用VS2012开发Windows服务,需要使用Log4net日志组件记录业务情况,但是始终生成不了日志文件. /// <summary> /// 入口方法 /// </summar ...

  8. 使用log4net将日志文件输出为csv格式

    我们在编写程序时,会在程序运行过程中记录一些日志.log4net作为一款经久耐用的日志组件,值得我们信赖.在中小型公司中,往往没有专业的日志服务器来处理应用程序产生的日志,而格式化不好的日志文件又为上 ...

  9. 解决log4net多进程日志文件被占用

    <log4net debug="true"> <appender name="RollingLogFileAppender" type=&qu ...

随机推荐

  1. 【Java的JNI快速学习教程】

    1. JNI简介 JNI是Java Native Interface的英文缩写,意为Java本地接口. 问题来源:由于Java编写底层的应用较难实现,在一些实时性要求非常高的部分Java较难胜任(实时 ...

  2. Hessian矩阵

    http://baike.baidu.com/link?url=o1ts6Eirjn5mHQCZUHGykiI8tDIdtHHOe6IDXagtcvF9ncOfdDOzT8tmFj41_DEsiUCr ...

  3. 20145102 Java 实验一

    20145102 Java 实验一 Java环境的安装 就像第一周写的一样,在linux下java的安装和配置简直简单的不行不行的,一个命令足以: sudo pacman -S jdk 配置什么的也就 ...

  4. ionic项目的一些简单操作

    1.首先保证开发环境没问题: 2.下载一个ionic项目:命令ionic start myApp tabs(myApp的项目的名称) 3.在运行项目之前,要先创建平台: ionic platform ...

  5. codeforces 675C C. Money Transfers(贪心)

    题目链接: C. Money Transfers time limit per test 1 second memory limit per test 256 megabytes input stan ...

  6. 转: Android基于HLS和RTMP协议的第三方SDK选择

    转自: http://isunxu.xyz/android/between-rtmp-and-hls-third-party-choice/ 协议的详解网上资料都太多了,我就不赘述了.Android上 ...

  7. 【转】google谷歌百度收录网站的技巧方法,如何让百度收录?

    下面由本人巴山给大家讲述一下搜索引擎收录网站的技巧虚拟主机 (1)在网站上线前,要有足够多的内容网站优化 确保网站在正式上线的时候,有100页以上的充实内容,而且这些内容尽可能的进行下编辑,优化,自己 ...

  8. Sql Server中的分组

    1.Group by可以将相同的数据合并为一组,分组后的数据可以看成是一个临时的表,注意如果sql中有where条件,那么group by必须放在where之后. 2.GROUP BY子句中可以指定多 ...

  9. Zend studio 12.5.1破解过程

    开始学习php了 今天又安装了一下Zend  之前找了很久的教程终于成了 , 今天换了一台电脑需要重新安装一下 又点忘记了. 就讲这个过程写下来 1.安装zend studio 12.5.1.这个过程 ...

  10. Linux密码更改

    男孩儿的灰色 QQ:936779899 2014.2.9 1. 进入单用户模式 2. 编辑passwd文件,删除X 3. 然后保存推出并编辑shadow文件 4. 删除标色部分,其他保持不变 5. 最 ...