{"action":"closed","issue":{"url":"https://api.github.com/repos/csnemes/tracer/issues/7","labels_url":"https://api.github.com/repos/csnemes/tracer/issues/7/labels{/name}","comments_url":"https://api.github.com/repos/csnemes/tracer/issues/7/comments","events_url":"https://api.github.com/repos/csnemes/tracer/issues/7/events","html_url":"https://github.com/csnemes/tracer/issues/7","id":101717883,"number":7,"title":"Failed static logger code generation","user":{"login":"Solasi","id":5077598,"avatar_url":"https://avatars.githubusercontent.com/u/5077598?v=3","gravatar_id":"","url":"https://api.github.com/users/Solasi","html_url":"https://github.com/Solasi","followers_url":"https://api.github.com/users/Solasi/followers","following_url":"https://api.github.com/users/Solasi/following{/other_user}","gists_url":"https://api.github.com/users/Solasi/gists{/gist_id}","starred_url":"https://api.github.com/users/Solasi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Solasi/subscriptions","organizations_url":"https://api.github.com/users/Solasi/orgs","repos_url":"https://api.github.com/users/Solasi/repos","events_url":"https://api.github.com/users/Solasi/events{/privacy}","received_events_url":"https://api.github.com/users/Solasi/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-08-18T18:16:13Z","updated_at":"2015-08-19T14:34:52Z","closed_at":"2015-08-19T14:34:52Z","body":"Hi - I'm using Tracer.Log4Net.Fody v1.1.1 (with Tracer.Fody v1.1.0) and running into 2 separate issues with the static logger code generation.  \r\n\r\nWhen trying to log inside the constructor of a class, the log lines fail to print, and when looking at the decompiled code with ILSpy I can see that the static logger code is not generated.  This is reproducible with the following program:\r\n\r\n```\r\nusing System.IO;\r\nusing Tracer.Log4Net;\r\n\r\nnamespace FodyLog4Net_Bug\r\n{\r\n    class Program\r\n    {\r\n        static void Main(string[] args)\r\n        {\r\n            log4net.Config.XmlConfigurator.ConfigureAndWatch(new FileInfo(\"log4net.config\"));\r\n\r\n            Log.Error(\"Test log message start\");\r\n            Foo foo = new Foo();\r\n        }\r\n    }\r\n\r\n    public class Foo\r\n    {\r\n        public Foo()\r\n        {\r\n            Log.Error(\"Logging inside the constructor\");\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nThe second issue is with closures, which have the same problem: failure to generate the proper static logger code causing log line failures.  Reproducible via the following code:\r\n\r\n```\r\nusing System.IO;\r\nusing Tracer.Log4Net;\r\n\r\nnamespace FodyLog4Net_Bug\r\n{\r\n    class Program\r\n    {\r\n        delegate void TestDelegate();\r\n\r\n        static void Main(string[] args)\r\n        {\r\n            log4net.Config.XmlConfigurator.ConfigureAndWatch(new FileInfo(\"log4net.config\"));\r\n\r\n            int foo = 1;\r\n            TestDelegate bar = () =>\r\n            {\r\n                foo++;\r\n                Log.Error(\"Logging inside a closure\");\r\n            };\r\n            bar();\r\n\r\n            TestDelegate baz = () =>\r\n            {\r\n                int qux = 1;\r\n                qux++;\r\n                Log.Error(\"Logging inside a normal lambda\");\r\n            };\r\n            baz();\r\n        }\r\n    }\r\n}\r\n```\r\n\r\nI'm using the same log4net.config in both cases:\r\n```\r\n<log4net>\r\n  <root>\r\n    <level value=\"DEBUG\" />\r\n    <appender-ref ref=\"LogFileAppender\" />\r\n  </root>\r\n  <appender name=\"LogFileAppender\" type=\"log4net.Appender.RollingFileAppender\" >\r\n    <param name=\"File\" value=\"log-file.txt\" />\r\n    <param name=\"AppendToFile\" value=\"true\" />\r\n    <rollingStyle value=\"Size\" />\r\n    <maxSizeRollBackups value=\"10\" />\r\n    <maximumFileSize value=\"10MB\" />\r\n    <staticLogFileName value=\"true\" />\r\n    <layout type=\"log4net.Layout.PatternLayout\">\r\n      <param name=\"ConversionPattern\" value=\"%date [%thread] %-5level %logger [%property{NDC}] - %message%newline\" />\r\n    </layout>\r\n  </appender>\r\n</log4net>\r\n```"}}