{"id":5519,"date":"2016-08-04T20:27:10","date_gmt":"2016-08-04T12:27:10","guid":{"rendered":"http:\/\/itmax.cn\/?p=5519"},"modified":"2017-02-23T16:06:57","modified_gmt":"2017-02-23T08:06:57","slug":"net%e6%a1%86%e6%9e%b6%ef%bc%9a%e5%bc%80%e6%ba%90%e6%97%a5%e5%bf%97%e8%ae%b0%e5%bd%95%e6%a1%86%e6%9e%b6","status":"publish","type":"post","link":"https:\/\/itmax.cn\/?p=5519","title":{"rendered":".NET\u6846\u67b6\uff1a\u5f00\u6e90\u65e5\u5fd7\u8bb0\u5f55\u6846\u67b6"},"content":{"rendered":"<p><!--done--><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><span style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">\u5728\u9879\u76ee\u5f00\u53d1\u4e2d\uff0c\u65e5\u5fd7\u8bb0\u5f55\u662f\u4efb\u4f55\u65f6\u5019\u90fd\u5c11\u4e0d\u4e86\u7684\uff0c\u7b80\u5355\u4ecb\u7ecd\u4e00\u4e0b\u5982\u4e0b\u51e0\u79cd\u65e5\u5fd7\u8bb0\u5f55\u5de5\u5177\uff0c\u4ee5\u53ca\u63a8\u8350\u4e00\u4e9b\u5b66\u4e60\u7684\u8d44\u6e90\uff1a<span lang=\"EN-US\"><o:p><\/o:p><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><span lang=\"EN-US\" style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">1<\/span><span style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">\uff0e<span lang=\"EN-US\">Log4net<o:p><\/o:p><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><span lang=\"EN-US\" style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">2<\/span><span style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">\uff0e<span lang=\"EN-US\">Logging Application Block<o:p><\/o:p><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><span lang=\"EN-US\" style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">3<\/span><span style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">\uff0e<span lang=\"EN-US\">NLog<o:p><\/o:p><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><span lang=\"EN-US\" style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\"><o:p>&nbsp;<\/o:p><\/span><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><strong style=\"mso-bidi-font-weight: normal\"><span style=\"FONT-SIZE: 10pt; COLOR: #006699; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">\u4e00\uff0e<span lang=\"EN-US\">Log4net<o:p><\/o:p><\/span><\/span><\/strong><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><span lang=\"EN-US\" style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">Log4net<\/span><span style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">\u662f\u4ece<span lang=\"EN-US\">java<\/span>\u5e73\u53f0\u4e0b\u975e\u5e38\u4f18\u79c0\u7684\u65e5\u5fd7\u8bb0\u5f55\u6846\u67b6<span lang=\"EN-US\">log4j<\/span>\u4e0a\u79fb\u690d\u5230<span lang=\"EN-US\">.NET<\/span>\u4e0b\u7684\uff0c\u5b83\u662f<span lang=\"EN-US\">apache<\/span>\u57fa\u91d1\u8d44\u52a9\u7684\u9879\u76ee\u7684\u4e00\u90e8\u5206\u3002<span lang=\"EN-US\">Log4net<\/span>\u53ef\u4ee5\u5e2e\u52a9\u6211\u4eec\u628a\u65e5\u5fd7\u4fe1\u606f\u8f93\u51fa\u5230\u5404\u79cd\u4e0d\u540c\u76ee\u6807\uff08\u6587\u672c\u6587\u4ef6\u3001\u6570\u636e\u5e93\u3001\u63a7\u5236\u53f0\u7b49\uff09\u7684<span lang=\"EN-US\">.net<\/span>\u7c7b\u5e93\uff0c\u5b83\u53ef\u4ee5\u5bb9\u6613\u7684\u52a0\u8f7d\u5230\u5f00\u53d1\u9879\u76ee\u4e2d<span lang=\"EN-US\">,<\/span>\u5b9e\u73b0\u7a0b\u5e8f\u8c03\u8bd5\u548c\u8fd0\u884c\u7684\u65f6\u5019\u7684\u65e5\u5fd7\u4fe1\u606f\u8f93\u51fa<span lang=\"EN-US\">,<\/span>\u63d0\u4f9b\u4e86\u6bd4<span lang=\"EN-US\">.net<\/span>\u81ea\u5df1\u63d0\u4f9b\u7684<span lang=\"EN-US\">debug<\/span>\u7c7b\u548c<span lang=\"EN-US\">trace<\/span>\u7c7b\u7684\u529f\u80fd\u66f4\u591a\uff0c\u4f7f\u7528\u8d77\u6765\u4e5f\u662f\u975e\u5e38\u7684\u7b80\u5355\u3002\u5728<span lang=\"EN-US\">Log4net <\/span>\u4e3b\u8981\u6709\u56db\u79cd\u91cd\u8981\u7684\u7ec4\u4ef6\uff0c\u5206\u522b\u662f<span lang=\"EN-US\">Logge, Repository, Appender<\/span>\u4ee5\u53ca<span lang=\"EN-US\"> Layout<\/span>\uff0c<span lang=\"EN-US\">Log4net<\/span>\u652f\u6301\u4e24\u79cd\u4e0d\u540c\u7684\u914d\u7f6e\u65b9\u5f0f\uff1a\u914d\u7f6e\u6587\u4ef6\u548c\u4ee3\u7801\u914d\u7f6e\uff0c\u4e00\u822c\u60c5\u51b5\u4e0b\u63a8\u8350\u4f7f\u7528\u914d\u7f6e\u6587\u4ef6\uff0c\u4e00\u4e2a\u5b8c\u6574\u7684\u914d\u7f6e\u793a\u4f8b\u5982\u4e0b\uff1a<\/span><\/p>\n<pre class=\"brush:c#;toolbar:false\">&lt;?xml&nbsp;version=&quot;1.0&quot;&nbsp;encoding=&quot;utf-8&quot;&nbsp;?&gt;\n&lt;configuration&gt;\n&nbsp;&nbsp;&lt;configSections&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;section&nbsp;name=&quot;log4net&quot;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type=&quot;log4net.Config.Log4NetConfigurationSectionHandler,&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;log4net-net-1.0&quot;&nbsp;\/&gt;\n&nbsp;&nbsp;&lt;\/configSections&gt;\n\n&nbsp;&nbsp;&lt;log4net&gt;\n\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;root&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;level&nbsp;value=&quot;WARN&quot;&nbsp;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;appender-ref&nbsp;ref=&quot;AdoNetAppender&quot;&nbsp;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;appender-ref&nbsp;ref=&quot;ConsoleAppender&quot;&nbsp;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/root&gt;\n\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;logger&nbsp;name=&quot;testApp.Logging&quot;&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;level&nbsp;value=&quot;DEBUG&quot;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/logger&gt;\n\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;appender&nbsp;name=&quot;AdoNetAppender&quot;&nbsp;type=&quot;log4net.Appender.AdoNetAppender&quot;&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;bufferSize&nbsp;value=&quot;100&quot;&nbsp;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;connectionType&nbsp;value=&quot;System.Data.SqlClient.SqlConnection,&nbsp;System.Data,&nbsp;Version=1.0.3300.0,&nbsp;Culture=neutral,&nbsp;PublicKeyToken=b77a5c561934e089&quot;&nbsp;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;connectionString&nbsp;value=&quot;data&nbsp;source=[database&nbsp;server];initial&nbsp;catalog=[database&nbsp;name];integrated&nbsp;security=false;persist&nbsp;security&nbsp;info=True;User&nbsp;ID=[user];Password=[password]&quot;&nbsp;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;commandText&nbsp;value=&quot;INSERT&nbsp;INTO&nbsp;Log&nbsp;([Date],[Thread],[Level],[Logger],[Message],[Exception])&nbsp;VALUES&nbsp;(@log_date,&nbsp;@thread,&nbsp;@log_level,&nbsp;@logger,&nbsp;@message,&nbsp;@exception)&quot;&nbsp;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;parameter&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;parameterName&nbsp;value=&quot;@log_date&quot;&nbsp;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dbType&nbsp;value=&quot;DateTime&quot;&nbsp;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;layout&nbsp;type=&quot;log4net.Layout.RawTimeStampLayout&quot;&nbsp;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/parameter&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;parameter&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;parameterName&nbsp;value=&quot;@thread&quot;&nbsp;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dbType&nbsp;value=&quot;String&quot;&nbsp;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;size&nbsp;value=&quot;255&quot;&nbsp;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;layout&nbsp;type=&quot;log4net.Layout.PatternLayout&quot;&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;conversionPattern&nbsp;value=&quot;%thread&quot;&nbsp;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/layout&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/parameter&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;parameter&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;parameterName&nbsp;value=&quot;@log_level&quot;&nbsp;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dbType&nbsp;value=&quot;String&quot;&nbsp;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;size&nbsp;value=&quot;50&quot;&nbsp;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;layout&nbsp;type=&quot;log4net.Layout.PatternLayout&quot;&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;conversionPattern&nbsp;value=&quot;%level&quot;&nbsp;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/layout&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/parameter&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;parameter&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;parameterName&nbsp;value=&quot;@logger&quot;&nbsp;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dbType&nbsp;value=&quot;String&quot;&nbsp;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;size&nbsp;value=&quot;255&quot;&nbsp;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;layout&nbsp;type=&quot;log4net.Layout.PatternLayout&quot;&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;conversionPattern&nbsp;value=&quot;%logger&quot;&nbsp;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/layout&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/parameter&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;parameter&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;parameterName&nbsp;value=&quot;@message&quot;&nbsp;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dbType&nbsp;value=&quot;String&quot;&nbsp;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;size&nbsp;value=&quot;4000&quot;&nbsp;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;layout&nbsp;type=&quot;log4net.Layout.PatternLayout&quot;&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;conversionPattern&nbsp;value=&quot;%message&quot;&nbsp;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/layout&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/parameter&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;parameter&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;parameterName&nbsp;value=&quot;@exception&quot;&nbsp;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;dbType&nbsp;value=&quot;String&quot;&nbsp;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;size&nbsp;value=&quot;2000&quot;&nbsp;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;layout&nbsp;type=&quot;log4net.Layout.ExceptionLayout&quot;&nbsp;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/parameter&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/appender&gt;\n\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;appender&nbsp;name=&quot;ConsoleAppender&quot;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type=&quot;log4net.Appender.ConsoleAppender&quot;&nbsp;&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;layout&nbsp;type=&quot;log4net.Layout.PatternLayout&quot;&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;param&nbsp;name=&quot;ConversionPattern&quot;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;value=&quot;%d&nbsp;[%t]&nbsp;%-5p&nbsp;%c&nbsp;[%x]&nbsp;-&nbsp;%m%n&quot;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/layout&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/appender&gt;\n\n&nbsp;&nbsp;&lt;\/log4net&gt;\n&lt;\/configuration&gt;<\/pre>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\">\u5728\u8be5\u793a\u4f8b\u4e2d\uff0c\u914d\u7f6e\u4e86\u4e24\u79cd\u76ee\u6807\u7684\u8f93\u51fa\uff0c\u5206\u522b\u4e3a\u6570\u636e\u5e93\u548c\u63a7\u5236\u53f0\u65b9\u5f0f\uff0c\u5728\u4ee3\u7801\u4e2d\u4f7f\u7528\u793a\u4f8b\uff1a<span lang=\"EN-US\" style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 150%; FONT-FAMILY: \u5b8b\u4f53\"><\/span><\/p>\n<pre class=\"brush:c#;toolbar:false\">Log4net.ILog&nbsp;log&nbsp;=&nbsp;Log4net.LogManager.GetLogger(&quot;MyLogger&quot;);&nbsp;\n\nif&nbsp;(log.IsDebugEnabled)\n&nbsp;&nbsp;&nbsp;&nbsp;log.Debug(&quot;message&quot;);&nbsp;\n\nif&nbsp;(log.IsInfoEnabled)\n&nbsp;&nbsp;&nbsp;log.Info(&quot;message&quot;);<\/pre>\n<p class=\"MsoNormal\" style=\"text-align:left;MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 150%; mso-layout-grid-align: none\">Log4net<span style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 150%; FONT-FAMILY: \u5b8b\u4f53\">\u5df2\u7ecf\u80fd\u591f\u5b8c\u5168\u6ee1\u8db3\u6211\u4eec\u65e5\u5e38\u5f00\u53d1\u7684\u65e5\u5fd7\u8bb0\u5f55\u529f\u80fd\uff0c\u4f46\u662f\u5b83\u5bb9\u6613\u4e3a\u4eba\u6240\u8bdf\u75c5\u7684\u4e00\u70b9\u662f\u6ca1\u6709\u53ef\u89c6\u5316\u7684\u914d\u7f6e\u5de5\u5177\u652f\u6301\uff0c\u9700\u8981\u624b\u5de5\u7f16\u5199\u914d\u7f6e\u6587\u4ef6\u3002\u5982\u679c\u4f60\u8fd8\u5728\u62c5\u5fc3\u8fd9\u4e00\u70b9\uff0c\u4e0d\u59a8\u770b\u770b\u8fd9\u7bc7\u300a<span lang=\"EN-US\"><a href=\"http:\/\/www.codeproject.com\/useritems\/Log4netEditor.asp\">Log4net GUI configuration tool<\/a><\/span>\u300b\u6587\u7ae0\uff0c\u6587\u4e2d\u4f5c\u8005\u4e3a\u6211\u4eec\u63d0\u4f9b\u4e86\u4e00\u79cd<span lang=\"EN-US\">Log4net<\/span>\u7684\u53ef\u89c6\u5316\u914d\u7f6e\u5de5\u5177\uff0c\u754c\u9762\u5982\u4e0b\u6240\u793a\uff1a<span lang=\"EN-US\"><o:p><\/o:p><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 150%\"><span lang=\"EN-US\" style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 150%; FONT-FAMILY: \u5b8b\u4f53\"><v:shapetype id=\"_x0000_t75\" stroked=\"f\" filled=\"f\" path=\"m@4@5l@4@11@9@11@9@5xe\" o:preferrelative=\"t\" o:spt=\"75\" coordsize=\"21600,21600\"><v:stroke joinstyle=\"miter\"><\/v:stroke><v:formulas><v:f eqn=\"if lineDrawn pixelLineWidth 0\"><\/v:f><v:f eqn=\"sum @0 1 0\"><\/v:f><v:f eqn=\"sum 0 0 @1\"><\/v:f><v:f eqn=\"prod @2 1 2\"><\/v:f><v:f eqn=\"prod @3 21600 pixelWidth\"><\/v:f><v:f eqn=\"prod @3 21600 pixelHeight\"><\/v:f><v:f eqn=\"sum @0 0 1\"><\/v:f><v:f eqn=\"prod @6 1 2\"><\/v:f><v:f eqn=\"prod @7 21600 pixelWidth\"><\/v:f><v:f eqn=\"sum @8 21600 0\"><\/v:f><v:f eqn=\"prod @7 21600 pixelHeight\"><\/v:f><v:f eqn=\"sum @10 21600 0\"><\/v:f><\/v:formulas><v:path o:connecttype=\"rect\" gradientshapeok=\"t\" o:extrusionok=\"f\"><\/v:path><o:lock aspectratio=\"t\" v:ext=\"edit\"><\/o:lock><\/v:shapetype><img loading=\"lazy\" decoding=\"async\" height=\"495\" alt=\"\" src=\"http:\/\/mumupudding.oss-cn-hangzhou.aliyuncs.com\/wp-content\/uploads\/2016\/08\/47771470317248.gif\" width=\"478\" border=\"0\"\/><o:p><\/o:p><\/span><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><span style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">\u5b98\u65b9\u4e3b\u9875\uff1a<span lang=\"EN-US\"><a href=\"http:\/\/logging.apache.org\/log4net\/\">http:\/\/logging.apache.org\/log4net\/<\/a><o:p><\/o:p><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><strong style=\"mso-bidi-font-weight: normal\"><span style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">\u5b66\u4e60\u8d44\u6599<span lang=\"EN-US\"><o:p><\/o:p><\/span><\/span><\/strong><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><span lang=\"EN-US\" style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">1<\/span><span style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">\uff0e<span lang=\"EN-US\">Log4net<\/span>\u7684<span lang=\"EN-US\"><a href=\"http:\/\/logging.apache.org\/log4net\/release\/features.html\"><span lang=\"EN-US\"><span lang=\"EN-US\">\u5b98\u65b9\u6587\u6863<\/span><\/span><\/a><o:p><\/o:p><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><span lang=\"EN-US\" style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">2<\/span><span style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">\uff0e<span lang=\"EN-US\">Sema<\/span>\u7ffb\u8bd1\u7684<span lang=\"EN-US\"><a href=\"http:\/\/www.cnblogs.com\/dragon\/archive\/2005\/03\/24\/124254.html\">Log4net<span lang=\"EN-US\"><span lang=\"EN-US\">\u4f7f\u7528\u6307\u5357<\/span><\/span><\/a> <\/span>\uff08\u4e2a\u4eba\u8ba4\u4e3a\uff0c\u5982\u679c\u4f60\u4ece\u6ca1\u6709\u63a5\u89e6\u8fc7<span lang=\"EN-US\">Log4net<\/span>\uff0c\u770b\u8fd9\u7bc7\u5c31\u8db3\u591f\u4f7f\u7528\u5b83\u4e86\uff09<span lang=\"EN-US\"><o:p><\/o:p><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><span lang=\"EN-US\" style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">3<\/span><span style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">\uff0e\u83e9\u63d0\u6811\u7684<span lang=\"EN-US\"><a href=\"http:\/\/heroman.cnblogs.com\/archive\/2006\/01\/09\/314053.html\">Log4net<span lang=\"EN-US\"><span lang=\"EN-US\">\u4e94\u6b65\u8d70<\/span><\/span><\/a><\/span>\u4e5f\u5f88\u503c\u5f97\u63a8\u8350\u3002<span lang=\"EN-US\"><o:p><\/o:p><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><span lang=\"EN-US\" style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\"><o:p>&nbsp;<\/o:p><\/span><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><strong style=\"mso-bidi-font-weight: normal\"><span style=\"FONT-SIZE: 10pt; COLOR: #006699; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">\u4e8c\uff0e<span lang=\"EN-US\">Logging Application Block<o:p><\/o:p><\/span><\/span><\/strong><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><span lang=\"EN-US\" style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">Logging Application Block<\/span><span style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">\u662f\u5fae\u8f6f<span lang=\"EN-US\">Enterprise Library<\/span>\u5176\u4e2d\u7684\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f\u5757\uff0c\u53ef\u4ee5\u4f7f\u5f00\u53d1\u4eba\u5458\u53ef\u4ee5\u5728\u5176\u5e94\u7528\u7a0b\u5e8f\u4e2d\u96c6\u6210\u6807\u51c6\u7684\u65e5\u5fd7\u548c\u76d1\u6d4b\u529f\u80fd\uff0c\u5e94\u7528\u7a0b\u5e8f\u53ef\u4ee5\u4f7f\u7528\u65e5\u5fd7\u548c\u76d1\u6d4b\u5757\u5728\u591a\u4e2a\u4f4d\u7f6e\u8bb0\u5f55\u4e8b\u4ef6\uff0c\u8bb0\u5f55\u7684\u4f4d\u7f6e\u5305\u62ec\uff1a\u4e8b\u4ef6\u65e5\u5fd7\uff08<span lang=\"EN-US\">Event Log<\/span>\uff09\u3001\u7535\u5b50\u90ae\u4ef6\uff08<span lang=\"EN-US\">Email<\/span>\uff09\u3001\u6570\u636e\u5e93\uff08<span lang=\"EN-US\">DataBase<\/span>\uff09\u3001\u6587\u672c\u6587\u4ef6\uff08<span lang=\"EN-US\">TextFile<\/span>\uff09\u3001\u6d88\u606f\u961f\u5217\uff08<span lang=\"EN-US\">MSMQ<\/span>\uff09\u3001<span lang=\"EN-US\">WMI<\/span>\u3001\u7528\u6237\u81ea\u5b9a\u4e49\u4f4d\u7f6e\u3002\u5e76\u4e14\u4f7f\u7528<span lang=\"EN-US\">Enterprise Library Configuration<\/span>\u5de5\u5177\u8fdb\u884c\u5b8c\u5168\u53ef\u89c6\u5316\u914d\u7f6e\uff0c\u5e76\u4e14\u53ef\u4ee5\u8bbe\u7f6e\u8f93\u51fa\u65e5\u5fd7\u4fe1\u606f\u7684\u683c\u5f0f\u3002\u5982\u56fe\u6240\u793a\uff1a<span lang=\"EN-US\"><o:p><\/o:p><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><span lang=\"EN-US\" style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\"><img loading=\"lazy\" decoding=\"async\" height=\"494\" alt=\"\" src=\"http:\/\/mumupudding.oss-cn-hangzhou.aliyuncs.com\/wp-content\/uploads\/2016\/08\/95351470317248.gif\" width=\"652\" border=\"0\"\/><o:p><\/o:p><\/span><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><span style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">\u914d\u7f6e\u5b8c\u6210\u540e\uff0c\u6240\u6709\u7684\u914d\u7f6e\u90fd\u653e\u5728\u4e86\u5e94\u7528\u7a0b\u5e8f\u914d\u7f6e\u6587\u4ef6\u91cc\u9762\uff08\u9488\u5bf9<span lang=\"EN-US\">EL2.0<\/span>\uff09\uff1a<\/span><span style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\"><\/span><\/p>\n<p><img decoding=\"async\" src=\"http:\/\/mumupudding.oss-cn-hangzhou.aliyuncs.com\/wp-content\/uploads\/2016\/08\/98341470317248.gif\" align=\"top\"\/><\/p>\n<pre class=\"brush:c#;toolbar:false\">&lt;configuration&gt;\n&nbsp;&nbsp;&lt;configSections&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;section&nbsp;name=&quot;loggingConfiguration&quot;&nbsp;type=&quot;Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings,&nbsp;Microsoft.Practices.EnterpriseLibrary.Logging&quot;&nbsp;\/&gt;\n&nbsp;&nbsp;&lt;\/configSections&gt;\n&nbsp;&nbsp;&lt;loggingConfiguration&nbsp;tracingEnabled=&quot;true&quot;&nbsp;defaultCategory=&quot;General&quot;&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;logFilters&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;add\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;name=&quot;Category&quot;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;type=&quot;Microsoft.Practices.EnterpriseLibrary.Logging.Filters.CategoryFilter,&nbsp;Microsoft.Practices.EnterpriseLibrary.Logging&quot;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;categoryFilterMode=&quot;AllowAllExceptDenied&quot;&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;categoryFilters&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;add&nbsp;name=&quot;UI&nbsp;Events&quot;&nbsp;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/categoryFilters&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/add&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;add&nbsp;name=&quot;Priority&quot;&nbsp;type=&quot;Microsoft.Practices.EnterpriseLibrary.Logging.Filters.PriorityFilter,&nbsp;Microsoft.Practices.EnterpriseLibrary.Logging&quot;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;minimumPriority=&quot;2&quot;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;add&nbsp;name=&quot;LogEnabled&nbsp;Filter&quot;&nbsp;type=&quot;Microsoft.Practices.EnterpriseLibrary.Logging.Filters.LogEnabledFilter,&nbsp;Microsoft.Practices.EnterpriseLibrary.Logging,&nbsp;Version=2.0.0.0,&nbsp;Culture=neutral,&nbsp;PublicKeyToken=null&quot;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;enabled=&quot;true&quot;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;\/logFilters&gt;\n&nbsp;&nbsp;&lt;\/loggingConfiguration&gt;\n&lt;\/configuration&gt;<\/pre>\n<p class=\"MsoNormal\" style=\"text-align:left;MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 150%; mso-layout-grid-align: none\">\u5728\u4ee3\u7801\u4e2d\u4f7f\u7528\u65f6\u975e\u5e38\u7b80\u5355\uff0c\u5982\u4e0b\u4ee3\u7801\u7247\u65ad\u6240\u793a\uff1a<span style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\"><\/span><\/p>\n<pre class=\"brush:c#;toolbar:false\">LogEntry&nbsp;logEntry&nbsp;=&nbsp;new&nbsp;LogEntry();\n\nlogEntry.EventId&nbsp;=&nbsp;100;\n\nlogEntry.Priority&nbsp;=&nbsp;2;\n\nlogEntry.Message&nbsp;=&nbsp;&quot;Informational&nbsp;message&quot;;\n\n\/\/\u8bbe\u7f6e\u591a\u4e2aCategory\n\nlogEntry.Categories.Add(&quot;Trace&quot;);\n\nlogEntry.Categories.Add(&quot;UI&nbsp;Events&quot;);\n\n\nLogger.Write(logEntry);<\/pre>\n<p class=\"MsoNormal\" style=\"text-align:left;MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 150%; mso-layout-grid-align: none\">\u5f88\u591a\u670b\u53cb\u4f7f\u7528<span lang=\"EN-US\">Logging Application Block<\/span>\uff0c\u6709\u4e00\u4e2a\u62c5\u5fc3\u7684\u5730\u65b9\u5c31\u662f<span lang=\"EN-US\">Enterprise Library 2.0<\/span>\u4e2d\u628a\u6240\u6709\u7684\u914d\u7f6e\u4fe1\u606f\u90fd\u653e\u5728\u4e86\u5e94\u7528\u7a0b\u5e8f\u914d\u7f6e\u6587\u4ef6\u91cc\u9762\uff0c\u8fd9\u6837\u7531\u914d\u7f6e\u5de5\u5177\u751f\u6210\u7684\u914d\u7f6e\u4ee3\u7801\u548c\u6211\u4eec\u624b\u5de5\u6dfb\u52a0\u7684\u4e00\u4e9b\u914d\u7f6e\u4ee3\u7801\u6df7\u5408\u5728\u4e00\u8d77\uff0c\u4f1a\u663e\u5f97\u975e\u5e38\u6df7\u4e71\uff0c\u5982\u679c\u4f60\u6709\u8fd9\u6837\u7684\u7591\u95ee\uff0c\u60f3\u628a\u6bcf\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f\u5757\u7684\u914d\u7f6e\u4fe1\u606f\u5355\u72ec\u653e\u5728\u5916\u90e8\u6587\u4ef6\u4e2d\uff0c\u4e0d\u59a8\u770b\u770b\u8fd9\u7bc7\u6587\u7ae0\u300a<span lang=\"EN-US\"><a href=\"http:\/\/www.cnblogs.com\/Terrylee\/archive\/2006\/07\/03\/enterprise_library2_1.html\">Enterprise Library 2.0 <span lang=\"EN-US\"><span lang=\"EN-US\">\u6280\u5de7\uff081<\/span><\/span><span lang=\"EN-US\"><span lang=\"EN-US\">\uff09\uff1a\u5982\u4f55\u4f7f\u7528\u5916\u90e8\u914d\u7f6e\u6587\u4ef6<\/span><\/span><\/a><\/span>\u300b<span lang=\"EN-US\"><o:p><\/o:p><\/span><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><span style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">\u5173\u4e8e<span lang=\"EN-US\">Logging Application Block<\/span>\u8fd8\u5e94\u8be5\u63d0\u4e00\u4e0b\u5b83\u7684\u53ef\u6269\u5c55\u6027\uff0c\u9664\u4e86\u7cfb\u7edf\u4e2d\u9ed8\u8ba4\u7684\u8f93\u51fa\u76ee\u6807\u4e4b\u5916\uff0c\u7528\u6237\u53ef\u4ee5\u81ea\u884c\u6269\u5c55\u81ea\u5df1\u7684\u76ee\u6807\uff0c\u6bd4\u5982\u8bf4\u63a7\u5236\u53f0\u7b49\uff1b\u9664\u6b64\u4e4b\u5916\uff0c\u7528\u6237\u4e5f\u53ef\u4ee5\u6269\u5c55\u81ea\u5df1\u7684\u65e5\u5fd7\u8f93\u51fa\u683c\u5f0f\uff0c\u6bd4\u5982\u8bf4<span lang=\"EN-US\">XML<\/span>\u683c\u5f0f\u7b49\u3002<span lang=\"EN-US\"><o:p><\/o:p><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><span style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">\u5b98\u65b9\u4e3b\u9875\uff1a<span lang=\"EN-US\"><a href=\"http:\/\/msdn.microsoft.com\/practices\/\">http:\/\/msdn.microsoft.com\/practices\/<\/a><o:p><\/o:p><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><strong style=\"mso-bidi-font-weight: normal\"><span style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">\u5b66\u4e60\u8d44\u6e90<span lang=\"EN-US\"><o:p><\/o:p><\/span><\/span><\/strong><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><span lang=\"EN-US\" style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">1<\/span><span style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">\uff0e<span lang=\"EN-US\"><a href=\"http:\/\/www.cnblogs.com\/Terrylee\/archive\/2005\/11\/02\/266999.html\">Enterprise Library Step By Step<span lang=\"EN-US\"><span lang=\"EN-US\">\u7cfb\u5217\uff08\u4e03\uff09\uff1a\u65e5\u5fd7\u548c\u76d1\u6d4b\u5e94\u7528\u7a0b\u5e8f\u5757\u2014\u2014\u5165\u95e8\u7bc7<\/span><\/span><\/a><o:p><\/o:p><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><span lang=\"EN-US\" style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">2<\/span><span style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">\uff0e<span lang=\"EN-US\"><a href=\"http:\/\/www.cnblogs.com\/Terrylee\/archive\/2005\/11\/08\/271205.html\">Enterprise Library Step By Step<span lang=\"EN-US\"><span lang=\"EN-US\">\u7cfb\u5217\uff08\u516b\uff09\uff1a\u65e5\u5fd7\u548c\u76d1\u6d4b\u5e94\u7528\u7a0b\u5e8f\u5757\u2014\u2014\u8fdb\u9636\u7bc7<\/span><\/span><\/a><o:p><\/o:p><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><span lang=\"EN-US\" style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">3<\/span><span style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">\uff0e<span lang=\"EN-US\"><a href=\"http:\/\/www.cnblogs.com\/Terrylee\/archive\/2006\/03\/22\/355923.html\">Enterprise Library 2.0<span lang=\"EN-US\"><span lang=\"EN-US\">\uff082<\/span><\/span><span lang=\"EN-US\"><span lang=\"EN-US\">\uff09\uff1aLogging Application Block<\/span><\/span><span lang=\"EN-US\"><span lang=\"EN-US\">\u5b66\u4e60<\/span><\/span><\/a><o:p><\/o:p><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><span lang=\"EN-US\" style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">4<\/span><span style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">\uff0e<span lang=\"EN-US\"><a href=\"http:\/\/www.cnblogs.com\/Terrylee\/archive\/2006\/07\/06\/enterprise_library2_3.html\">Enterprise Library 2.0 <span lang=\"EN-US\"><span lang=\"EN-US\">\u6280\u5de7\uff083<\/span><\/span><span lang=\"EN-US\"><span lang=\"EN-US\">\uff09\uff1a\u8bb0\u5f55ASP.NET<\/span><\/span><span lang=\"EN-US\"><span lang=\"EN-US\">\u7ad9\u70b9\u4e2d\u672a\u5904\u7406\u7684\u5f02\u5e38<\/span><\/span><\/a><o:p><\/o:p><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><span lang=\"EN-US\" style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">5<\/span><span style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">\uff0e<span lang=\"EN-US\"><a href=\"http:\/\/www.cnblogs.com\/Terrylee\/archive\/2006\/07\/08\/enterprise_library2_4.html\">Enterprise Library 2.0 <span lang=\"EN-US\"><span lang=\"EN-US\">\u6280\u5de7\uff084<\/span><\/span><span lang=\"EN-US\"><span lang=\"EN-US\">\uff09\uff1a\u5982\u4f55\u7528\u7f16\u7a0b\u7684\u65b9\u6cd5\u6765\u914d\u7f6eLogging Application Block<\/span><\/span><\/a><o:p><\/o:p><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><span lang=\"EN-US\" style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">6<\/span><span style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">\uff0e<span lang=\"EN-US\"><a href=\"http:\/\/www.cnblogs.com\/Terrylee\/archive\/2006\/10\/06\/Logging_Application_Block_HandsOnLab_Part1.html\">Enterprise Library 2.0 Hands On Lab <span lang=\"EN-US\"><span lang=\"EN-US\">\u7ffb\u8bd1\uff084<\/span><\/span><span lang=\"EN-US\"><span lang=\"EN-US\">\uff09\uff1a\u65e5\u5fd7\u5e94\u7528\u7a0b\u5e8f\u5757\uff08\u4e00\uff09<\/span><\/span><\/a><o:p><\/o:p><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><span lang=\"EN-US\" style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">7<\/span><span style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">\uff0e<span lang=\"EN-US\"><a href=\"http:\/\/www.cnblogs.com\/Terrylee\/archive\/2006\/10\/06\/Logging_Application_Block_HandsOnLab_Part2.html\">Enterprise Library 2.0 Hands On Lab <span lang=\"EN-US\"><span lang=\"EN-US\">\u7ffb\u8bd1\uff085<\/span><\/span><span lang=\"EN-US\"><span lang=\"EN-US\">\uff09\uff1a\u65e5\u5fd7\u5e94\u7528\u7a0b\u5e8f\u5757\uff08\u4e8c\uff09<\/span><\/span><\/a><o:p><\/o:p><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><span lang=\"EN-US\" style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">8<\/span><span style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">\uff0e<span lang=\"EN-US\"><a href=\"http:\/\/www.cnblogs.com\/Terrylee\/archive\/2006\/10\/06\/Logging_Application_Block_HandsOnLab_Part3.html\">Enterprise Library 2.0 Hands On Lab <span lang=\"EN-US\"><span lang=\"EN-US\">\u7ffb\u8bd1\uff086<\/span><\/span><span lang=\"EN-US\"><span lang=\"EN-US\">\uff09\uff1a\u65e5\u5fd7\u5e94\u7528\u7a0b\u5e8f\u5757\uff08\u4e09\uff09<\/span><\/span><\/a><o:p><\/o:p><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><span lang=\"EN-US\" style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\"><o:p>&nbsp;<\/o:p><\/span><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><strong style=\"mso-bidi-font-weight: normal\"><span style=\"FONT-SIZE: 10pt; COLOR: #006699; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">\u4e09\uff0e<span lang=\"EN-US\">NLog<o:p><\/o:p><\/span><\/span><\/strong><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><span lang=\"EN-US\" style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">NLog<\/span><span style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">\u662f<span lang=\"EN-US\">C#<\/span>\u7f16\u5199\u7684\u5f00\u6e90\u65e5\u5fd7\u7c7b\u5e93\uff0c\u5b83\u7684\u8bbe\u8ba1\u601d\u60f3\u662f\u4f7f\u5176\u7b80\u5355\u800c\u7075\u6d3b\u3002<span lang=\"EN-US\">NLog<\/span>\u8ba9\u4f60\u5904\u7406\u8bca\u65ad\u7684\u65e5\u5fd7\u6d88\u606f\uff0c\u7528\u76f8\u5173\u4fe1\u606f\u6269\u5145\u6d88\u606f\uff0c\u4f9d\u7167\u4f60\u7684\u9009\u62e9\u683c\u5f0f\u5316\u65e5\u5fd7\u6d88\u606f\u548c\u628a\u65e5\u5fd7\u6d88\u606f\u8f93\u51fa\u5230\u4e00\u4e2a\u6216\u591a\u4e2a\u76ee\u7684\u5730\uff0c\u57fa\u672c\u4e0a\u7c7b\u4f3c\u4e8e<span lang=\"EN-US\">Log4net<\/span>\u3002\u540c\u6837\uff0c<span lang=\"EN-US\">NLog<\/span>\u4e5f\u63d0\u4f9b\u4e86\u5f88\u591a\u7684\u6269\u5c55\uff0c\u53ef\u4ee5\u81ea\u5b9a\u4e49\u65e5\u5fd7\u8f93\u51fa\u76ee\u6807\uff0c\u65e5\u5fd7\u683c\u5f0f\uff0c\u8fc7\u6ee4\u5668\u7b49\u3002\u770b\u4e00\u4e2a\u7b80\u5355\u7684\u914d\u7f6e\u793a\u4f8b\uff1a<\/span><span style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\"><\/span><\/p>\n<pre class=\"brush:c#;toolbar:false\">&lt;nlog&nbsp;xmlns=&quot;http:\/\/www.nlog-project.org\/schemas\/NLog.xsd&quot;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;xmlns:xsi=&quot;http:\/\/www.w3.org\/2001\/XMLSchema-instance&quot;&gt;\n&nbsp;&nbsp;&lt;targets&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;target&nbsp;name=&quot;console&quot;&nbsp;xsi:type=&quot;ColoredConsole&quot;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;layout=&quot;${date:format=HH\\:mm\\:ss}|${level}|${stacktrace}|${message}&quot;\/&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;target&nbsp;name=&quot;file&quot;&nbsp;xsi:type=&quot;File&quot;&nbsp;fileName=&quot;${basedir}\/file.txt&quot;&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;layout=&quot;${stacktrace}&nbsp;${message}&quot;\/&gt;\n&nbsp;&nbsp;&lt;\/targets&gt;\n&nbsp;&nbsp;&lt;rules&gt;\n&nbsp;&nbsp;&nbsp;&nbsp;&lt;logger&nbsp;name=&quot;*&quot;&nbsp;minlevel=&quot;Trace&quot;&nbsp;writeTo=&quot;console,file&quot;\/&gt;\n&nbsp;&nbsp;&lt;\/rules&gt;\n&lt;\/nlog&gt;<\/pre>\n<p class=\"MsoNormal\" style=\"text-align:left;MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 150%; mso-layout-grid-align: none\">\u5728\u4ee3\u7801\u4e2d\u4f7f\u7528\u5982\u4e0b\u6240\u793a\uff1a<\/p>\n<pre class=\"brush:c#;toolbar:false\">static&nbsp;void&nbsp;C()&nbsp;\n{&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;logger.Info(&quot;Info&nbsp;CCC&quot;);&nbsp;\n}&nbsp;\n\nstatic&nbsp;void&nbsp;B()&nbsp;\n{&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;logger.Trace(&quot;Trace&nbsp;BBB&quot;);&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;logger.Debug(&quot;Debug&nbsp;BBB&quot;);&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;logger.Info(&quot;Info&nbsp;BBB&quot;);&nbsp;\n\n&nbsp;&nbsp;&nbsp;&nbsp;C();&nbsp;\n\n&nbsp;&nbsp;&nbsp;&nbsp;logger.Warn(&quot;Warn&nbsp;BBB&quot;);&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;logger.Error(&quot;Error&nbsp;BBB&quot;);&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;logger.Fatal(&quot;Fatal&nbsp;BBB&quot;);&nbsp;\n}&nbsp;\n\nstatic&nbsp;void&nbsp;A()&nbsp;\n{&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;logger.Trace(&quot;Trace&nbsp;AAA&quot;);&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;logger.Debug(&quot;Debug&nbsp;AAA&quot;);&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;logger.Info(&quot;Info&nbsp;AAA&quot;);&nbsp;\n\n&nbsp;&nbsp;&nbsp;&nbsp;B();&nbsp;\n\n&nbsp;&nbsp;&nbsp;&nbsp;logger.Warn(&quot;Warn&nbsp;AAA&quot;);&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;logger.Error(&quot;Error&nbsp;AAA&quot;);&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;logger.Fatal(&quot;Fatal&nbsp;AAA&quot;);&nbsp;\n}&nbsp;\n\nstatic&nbsp;void&nbsp;Main(string[]&nbsp;args)&nbsp;\n{&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;logger.Trace(&quot;This&nbsp;is&nbsp;a&nbsp;Trace&nbsp;message&quot;);&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;logger.Debug(&quot;This&nbsp;is&nbsp;a&nbsp;Debug&nbsp;message&quot;);&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;logger.Info(&quot;This&nbsp;is&nbsp;an&nbsp;Info&nbsp;message&quot;);&nbsp;\n\n&nbsp;&nbsp;&nbsp;&nbsp;A();&nbsp;\n\n&nbsp;&nbsp;&nbsp;&nbsp;logger.Warn(&quot;This&nbsp;is&nbsp;a&nbsp;Warn&nbsp;message&quot;);&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;logger.Error(&quot;This&nbsp;is&nbsp;an&nbsp;Error&nbsp;message&quot;);&nbsp;\n&nbsp;&nbsp;&nbsp;&nbsp;logger.Fatal(&quot;This&nbsp;is&nbsp;a&nbsp;Fatal&nbsp;error&nbsp;message&quot;);&nbsp;\n\n}<\/pre>\n<p class=\"MsoNormal\" style=\"text-align:left;MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 150%; mso-layout-grid-align: none\"><span lang=\"EN-US\" style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 150%; FONT-FAMILY: \u5b8b\u4f53\">NLog<\/span><span style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 150%; FONT-FAMILY: \u5b8b\u4f53\">\u867d\u7136\u6ca1\u6709\u63d0\u4f9b\u53ef\u89c6\u5316\u7684\u914d\u7f6e\u5de5\u5177\uff0c\u4f46\u662f\u5b89\u88c5\u540e\uff0c\u6211\u4eec\u4f1a\u5728<span lang=\"EN-US\">VS2005<\/span>\u7684<span lang=\"EN-US\">New Item<\/span>\u91cc\u9762\u770b\u5230\u6709\u5173\u672c<span lang=\"EN-US\">NLog<\/span>\u7684\u914d\u7f6e\u6587\u4ef6\u8fd9\u4e48\u4e00\u9879\uff0c\u662f\u7528\u8be5\u914d\u7f6e\u6587\u4ef6\u662f\u652f\u6301\u81ea\u52a8\u8865\u5168\u529f\u80fd\u7684\u3002<span lang=\"EN-US\"><o:p><\/o:p><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 150%\"><span lang=\"EN-US\" style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 150%; FONT-FAMILY: \u5b8b\u4f53\"><img loading=\"lazy\" decoding=\"async\" height=\"282\" alt=\"\" src=\"http:\/\/mumupudding.oss-cn-hangzhou.aliyuncs.com\/wp-content\/uploads\/2016\/08\/91361470317249.gif\" width=\"493\" border=\"0\"\/><o:p><\/o:p><\/span><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><span style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">\u5b98\u65b9\u4e3b\u9875\uff1a<span lang=\"EN-US\"><a href=\"http:\/\/www.nlog-project.org\/\">http:\/\/www.nlog-project.org\/<\/a><o:p><\/o:p><\/span><\/span><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><strong style=\"mso-bidi-font-weight: normal\"><span style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">\u5b66\u4e60\u8d44\u6e90<span lang=\"EN-US\"><o:p><\/o:p><\/span><\/span><\/strong><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><span style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\">\u6ca1\u6709\u53d1\u73b0\u76ee\u524d\u6709\u597d\u7684\u4e2d\u6587\u5b66\u4e60\u8d44\u6e90\uff0c\u5927\u5bb6\u53ef\u4ee5\u53c2\u8003<span lang=\"EN-US\"><a href=\"http:\/\/www.nlog-project.org\/documentation.html\"><span lang=\"EN-US\"><span lang=\"EN-US\">\u5b98\u65b9\u6587\u6863<\/span><\/span><\/a><\/span>\uff0c\u5e0c\u671b\u6709\u65f6\u95f4\u53ef\u4ee5\u5199\u51e0\u7bc7<span lang=\"EN-US\">NLog<\/span>\u7684\u4f7f\u7528\u6559\u7a0b\uff0c\u5f25\u8865\u4e00\u4e0b\u5f53\u524d\u4e2d\u6587\u6587\u6863\u7684\u7a7a\u7f3a\u3002<\/span><\/p>\n<p class=\"MsoNormal\" style=\"MARGIN: 0cm 0cm 0pt; LINE-HEIGHT: 200%\"><span style=\"FONT-SIZE: 10pt; LINE-HEIGHT: 200%; FONT-FAMILY: \u5b8b\u4f53\"><br \/><\/span><\/p>\n<p><!--end: topics \u6587\u7ae0\u3001\u8bc4\u8bba\u5bb9\u5668--><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u9879\u76ee\u5f00\u53d1\u4e2d\uff0c\u65e5\u5fd7\u8bb0\u5f55\u662f\u4efb\u4f55\u65f6\u5019\u90fd\u5c11\u4e0d\u4e86\u7684\uff0c\u7b80\u5355\u4ecb\u7ecd\u4e00\u4e0b\u5982\u4e0b\u51e0\u79cd\u65e5\u5fd7\u8bb0\u5f55\u5de5\u5177\uff0c\u4ee5\u53ca\u63a8\u8350\u4e00\u4e9b\u5b66\u4e60\u7684\u8d44\u6e90\uff1a 1\uff0eL [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":5848,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[],"tags":[],"class_list":["post-5519","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry"],"jetpack_sharing_enabled":true,"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/5519","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5519"}],"version-history":[{"count":0,"href":"https:\/\/itmax.cn\/index.php?rest_route=\/wp\/v2\/posts\/5519\/revisions"}],"wp:attachment":[{"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5519"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5519"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itmax.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5519"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}