{"action":"created","issue":{"url":"https://api.github.com/repos/NLog/NLog/issues/721","labels_url":"https://api.github.com/repos/NLog/NLog/issues/721/labels{/name}","comments_url":"https://api.github.com/repos/NLog/NLog/issues/721/comments","events_url":"https://api.github.com/repos/NLog/NLog/issues/721/events","html_url":"https://github.com/NLog/NLog/issues/721","id":81475881,"number":721,"title":"LogManager threw an exception in a static constructor","user":{"login":"VerdonTrigance","id":12109173,"avatar_url":"https://avatars.githubusercontent.com/u/12109173?v=3","gravatar_id":"","url":"https://api.github.com/users/VerdonTrigance","html_url":"https://github.com/VerdonTrigance","followers_url":"https://api.github.com/users/VerdonTrigance/followers","following_url":"https://api.github.com/users/VerdonTrigance/following{/other_user}","gists_url":"https://api.github.com/users/VerdonTrigance/gists{/gist_id}","starred_url":"https://api.github.com/users/VerdonTrigance/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/VerdonTrigance/subscriptions","organizations_url":"https://api.github.com/users/VerdonTrigance/orgs","repos_url":"https://api.github.com/users/VerdonTrigance/repos","events_url":"https://api.github.com/users/VerdonTrigance/events{/privacy}","received_events_url":"https://api.github.com/users/VerdonTrigance/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/NLog/NLog/labels/bug","name":"bug","color":"fc2929"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-05-27T14:42:43Z","updated_at":"2015-05-28T08:00:25Z","closed_at":null,"body":"Hello. I'm going to use NLog with SharePoint 2010.\r\nI have my custom TimerJob that I want to log.\r\nIn a static constructor I tries to set config throught Configuration API and implenet Logger like that:\r\n\r\n```c#\r\nstatic TimerJob()\r\n        {            \r\n            // Step 1. Create configuration object \r\n            var config = new LoggingConfiguration();\r\n\r\n            // Step 2. Create targets and add them to the configuration \r\n            var eventLogInfoTarget = new EventLogTarget();\r\n            config.AddTarget(\"eventLogInfoTarget\", eventLogInfoTarget);\r\n\r\n            // Step 3. Set target properties \r\n            eventLogInfoTarget.Layout = \"${longdate}\\n${logger}\\n${level:uppercase=true}\\n${message}\";\r\n            eventLogInfoTarget.Source = typeof(TimerJob).Namespace;\r\n            eventLogInfoTarget.EventId = \"1\";\r\n\r\n            // Step 4. Define rules\r\n            var rule1 = new LoggingRule(typeof(TimerJob).FullName, LogLevel.Info, eventLogInfoTarget);\r\n            config.LoggingRules.Add(rule1);\r\n\r\n            // Step 5. Activate the configuration\r\n            LogManager.Configuration = config;\r\n            Logger = LogManager.GetCurrentClassLogger();\r\n        }\r\n\r\n\r\n```\r\n\r\nApplication compiles well, but when I deploy it to my SharePoint Application I get:\r\nError occurred in deployment step 'Add Solution': The type initializer for 'TimerJob' threw an exception.\r\nI also tried to add:\r\nInternalLogger.LogFile = @\"C:\\NLOG.txt\";\r\nInternalLogger.LogLevel = LogLevel.Trace;\r\nLogManager.ThrowExceptions = true;\r\nBut nothing happened.\r\nAnyone knows why LogManager act like this in a static context?"},"comment":{"url":"https://api.github.com/repos/NLog/NLog/issues/comments/106223072","html_url":"https://github.com/NLog/NLog/issues/721#issuecomment-106223072","issue_url":"https://api.github.com/repos/NLog/NLog/issues/721","id":106223072,"user":{"login":"304NotModified","id":5808377,"avatar_url":"https://avatars.githubusercontent.com/u/5808377?v=3","gravatar_id":"","url":"https://api.github.com/users/304NotModified","html_url":"https://github.com/304NotModified","followers_url":"https://api.github.com/users/304NotModified/followers","following_url":"https://api.github.com/users/304NotModified/following{/other_user}","gists_url":"https://api.github.com/users/304NotModified/gists{/gist_id}","starred_url":"https://api.github.com/users/304NotModified/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/304NotModified/subscriptions","organizations_url":"https://api.github.com/users/304NotModified/orgs","repos_url":"https://api.github.com/users/304NotModified/repos","events_url":"https://api.github.com/users/304NotModified/events{/privacy}","received_events_url":"https://api.github.com/users/304NotModified/received_events","type":"User","site_admin":false},"created_at":"2015-05-28T08:00:25Z","updated_at":"2015-05-28T08:00:25Z","body":"Do you have problems when using the Nuget package of NLog 4.0 RC (with .Net 3.5)? Or do you build manually? "}}