{"id":917,"date":"2015-04-13T13:33:24","date_gmt":"2015-04-13T04:33:24","guid":{"rendered":"http:\/\/blog.moramcnt.com\/?p=917"},"modified":"2015-04-13T14:03:27","modified_gmt":"2015-04-13T05:03:27","slug":"c-log4net-%ec%82%ac%ec%9a%a9","status":"publish","type":"post","link":"http:\/\/blog.moramcnt.com\/?p=917","title":{"rendered":"C# Winform \ub610\ub294 Console App\uc5d0\uc11c Log4Net \uc0ac\uc6a9"},"content":{"rendered":"<p>Java\uc5d0\uc11c \ub9ce\uc774 \uc0ac\uc6a9\ud558\ub294 Log4J\uc758 \ub2f7\ub137\ubc84\uc804\uc778 Log4Net\uc744 \uc774\uc6a9\ud558\uc5ec \ub85c\uadf8\ub97c \ub0a8\uae38 \uacbd\uc6b0 \uc544\ub798\uc640 \uac19\uc774<br \/>\n\uc0ac\uc6a9\ud558\uba74 \ub41c\ub2e4.<\/p>\n<p>1. Log4Net \ub2e4\uc6b4\ub85c\ub4dc<br \/>\n &#8211; http:\/\/logging.apache.org\/log4net\/download_log4net.cgi<\/p>\n<p>2. \ucc38\uc870 \ucd94\uac00<br \/>\n   Visual Studio\uc758 \ud504\ub85c\uc81d\ud2b8\uc5d0\uc11c log4net.dll\uc744 \ucc38\uc870\ub85c \ucd94\uac00\ud55c\ub2e4.<\/p>\n<p>3. app.config<br \/>\n   \uc5b4\ud50c\ub9ac\ucf00\uc774\uc158\uc758 \ud658\uacbd\uc124\uc815\ud30c\uc77c\uc778 app.config\ud30c\uc77c\uc5d0 \uc544\ub798\uc640 \uac19\uc774 \uc218\uc815\ud55c\ub2e4.<br \/>\n   \u203b \ucc38\uace0\ub85c configSections\uc740 \ub300\uc18c\ubb38\uc790\ub97c \uc815\ud655\ud788 \uad6c\ubd84\ud574 \uc368\uc57c\ud55c\ub2e4.<br \/>\n\ucc98\uc74c\uc5d0 \uc778\ud130\ub137\uac80\uc0c9\uc744 \ud1b5\ud574 \uce74\ud53c\ud574\uc628 \ub0b4\uc6a9\uc911\uc5d0 configsections\uc774\ub77c\uace0 \uc801\ud600 \uc788\uc5b4\uc11c \uadf8 \ub355\uc5d0 \uace0\uc0dd\uc880 \ud55c\uac83\uac19\ub2e4.<\/p>\n<pre>\r\n<?xml version=\"1.0\"?>\r\n<configuration>\r\n\t<configSections>\r\n\t\t<section name=\"log4net\" type=\"log4net.Config.Log4NetConfigurationSectionHandler, log4net\"\/>\r\n\t<\/configSections>\r\n\t<startup><supportedRuntime version=\"v4.0\" sku=\".NETFramework,Version=v4.0\"\/><\/startup>\r\n\t<log4net>\r\n\t\t<appender name=\"RollingFile\" type=\"log4net.Appender.RollingFileAppender\">\r\n\t\t\t<file value=\".\/Log\/Demo.Client.log\"\/>\r\n\t\t\t<appendtofile value=\"true\"\/>\r\n\t\t\t<maximumfilesize value=\"100KB\"\/>\r\n\t\t\t<maxsizerollbackups value=\"2\"\/>\r\n\t\t\t<layout type=\"log4net.Layout.PatternLayout\">\r\n\t\t\t\t<conversionpattern value=\"[%level] %date - %message%newline\"\/>\r\n\t\t\t<\/layout>\r\n\t\t<\/appender>\r\n\t\t<root>\r\n\t\t\t<level value=\"DEBUG\"\/>\r\n\t\t\t<appender-ref ref=\"RollingFile\"\/>\r\n\t\t<\/root>\r\n\t<\/log4net>\r\n<\/configuration>\r\n<\/pre>\n<p>4. AssemblyInfo.cs<br \/>\n &#8211; Properties \ud30c\uc77c\uc758 AssemblyInfo.cs\uc5d0 \uc544\ub798 \ub0b4\uc6a9\uc744 \ucd94\uac00<\/p>\n<pre>\r\n[assembly: log4net.Config.XmlConfigurator(Watch = true)]\r\n<\/pre>\n<p>5. \ud504\ub85c\uadf8\ub7a8 \uba54\uc778<br \/>\n   BasicConfigurator.Configure()\ub97c \uc548\ud558\uace0 log.Debug\ub9cc \ud588\uc744\uacbd\uc6b0 \ub85c\uadf8\uac00 \ud30c\uc77c\ub85c \uc548\ub0a8\uaca8\uc9c8\uc218 \uc788\uc73c\ubbc0\ub85c \uc8fc\uc758\ud574\uc57c \ud55c\ub2e4.<\/p>\n<pre>\r\n        private static readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);\r\n\r\n\t[STAThread]\r\n        static void Main(string[] args)\r\n\t{\r\n\t\tlog4net.Config.BasicConfigurator.Configure();\r\n\t\tlog.Debug(\"\ubaa8\ub78c\uc528\uc564\ud2f0 (moramcnt)\");\r\n        }\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Java\uc5d0\uc11c \ub9ce\uc774 \uc0ac\uc6a9\ud558\ub294 Log4J\uc758 \ub2f7\ub137\ubc84\uc804\uc778 Log4Net\uc744 \uc774\uc6a9\ud558\uc5ec \ub85c\uadf8\ub97c \ub0a8\uae38 \uacbd\uc6b0 \uc544\ub798\uc640 \uac19\uc774 \uc0ac\uc6a9\ud558\uba74 \ub41c\ub2e4. 1. Log4Net \ub2e4\uc6b4\ub85c\ub4dc &#8211; http:\/\/logging.apache.org\/log4net\/download_log4net.cgi 2. \ucc38\uc870 \ucd94\uac00 Visual Studio\uc758 \ud504\ub85c\uc81d\ud2b8\uc5d0\uc11c log4net.dll\uc744 \ucc38\uc870\ub85c \ucd94\uac00\ud55c\ub2e4. 3. app.config \uc5b4\ud50c\ub9ac\ucf00\uc774\uc158\uc758 \ud658\uacbd\uc124\uc815\ud30c\uc77c\uc778 app.config\ud30c\uc77c\uc5d0 \uc544\ub798\uc640 \uac19\uc774 \uc218\uc815\ud55c\ub2e4. \u203b \ucc38\uace0\ub85c configSections\uc740 \ub300\uc18c\ubb38\uc790\ub97c \uc815\ud655\ud788 \uad6c\ubd84\ud574 \uc368\uc57c\ud55c\ub2e4. \ucc98\uc74c\uc5d0 \uc778\ud130\ub137\uac80\uc0c9\uc744 \ud1b5\ud574 \uce74\ud53c\ud574\uc628 \ub0b4\uc6a9\uc911\uc5d0 configsections\uc774\ub77c\uace0 \uc801\ud600 \uc788\uc5b4\uc11c \uadf8 \ub355\uc5d0 \uace0\uc0dd\uc880 \ud55c\uac83\uac19\ub2e4. [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[8,163,4],"tags":[161,160,162,164],"class_list":["post-917","post","type-post","status-publish","format-standard","hentry","category-dotnet","category-winform","category-4","tag-c","tag-c-log4net-","tag-log4net-","tag-winform"],"_links":{"self":[{"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/posts\/917","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=917"}],"version-history":[{"count":7,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/posts\/917\/revisions"}],"predecessor-version":[{"id":925,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=\/wp\/v2\/posts\/917\/revisions\/925"}],"wp:attachment":[{"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=917"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=917"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.moramcnt.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=917"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}