{"action":"created","issue":{"url":"https://api.github.com/repos/NLog/NLog/issues/1599","repository_url":"https://api.github.com/repos/NLog/NLog","labels_url":"https://api.github.com/repos/NLog/NLog/issues/1599/labels{/name}","comments_url":"https://api.github.com/repos/NLog/NLog/issues/1599/comments","events_url":"https://api.github.com/repos/NLog/NLog/issues/1599/events","html_url":"https://github.com/NLog/NLog/issues/1599","id":171918664,"number":1599,"title":"System.ArgumentException: LayoutRenderer cannot be found: 'longdate' when creating new target programatically","user":{"login":"Babbie","id":11524583,"avatar_url":"https://avatars.githubusercontent.com/u/11524583?v=3","gravatar_id":"","url":"https://api.github.com/users/Babbie","html_url":"https://github.com/Babbie","followers_url":"https://api.github.com/users/Babbie/followers","following_url":"https://api.github.com/users/Babbie/following{/other_user}","gists_url":"https://api.github.com/users/Babbie/gists{/gist_id}","starred_url":"https://api.github.com/users/Babbie/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Babbie/subscriptions","organizations_url":"https://api.github.com/users/Babbie/orgs","repos_url":"https://api.github.com/users/Babbie/repos","events_url":"https://api.github.com/users/Babbie/events{/privacy}","received_events_url":"https://api.github.com/users/Babbie/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,"assignees":[],"milestone":null,"comments":16,"created_at":"2016-08-18T14:44:03Z","updated_at":"2016-09-21T15:47:58Z","closed_at":null,"body":"**Type**: Bug\r\n\r\n**NLog version**: 4.3.7 (latest)\r\n\r\n**Platform**: Xamarin Android\r\n\r\n**Current NLog config**\r\n\r\n```c#\r\npublic static void ConfigureAll()\r\n{\r\n        LoggingConfiguration config = new LoggingConfiguration();\r\n        config = ConfigureConsole(config);\r\n        LogManager.Configuration = config;\r\n        Debug.Write(\"Logger linked!\");\r\n}\r\n\r\npublic static LoggingConfiguration ConfigureConsole(LoggingConfiguration config)\r\n{\r\n        ConsoleTarget consoleTarget = new ConsoleTarget();\r\n\r\n        consoleTarget.Name = \"Console\";\r\n        consoleTarget.Layout = @\"${date:format=HH\\:mm\\:ss.fff}|${pad:padding=5:inner=${level:uppercase=true}}|${pad:padding=30:fixedLength=True:inner=${logger}}: ${message}\";\r\n\r\n        LoggingRule rule1 = new LoggingRule(\"*\", Constants.ConsoleLogLevel, consoleTarget);\r\n\r\n        config.AddTarget(\"console\", consoleTarget);\r\n        config.LoggingRules.Add(rule1);\r\n\r\n        return config;\r\n}\r\n```\r\n\r\n- What is the current result?\r\n-- When running the above code, the application throws a ``System.ArgumentException`` on the ``new ConsoleTarget();`` with the message that the ``longdate`` ``LayoutRenderer`` cannot be found.\r\n- What is the expected result?\r\n-- No exception (obviously)\r\n- Did you checked the [Internal log](https://github.com/NLog/NLog/wiki/Internal-Logging)?\r\n-- No, cannot work out how to do this on Android.\r\n- Please post full exception details (message, stacktrace, inner exceptions)\r\n```\r\n08-18 16:38:19.120 I/MonoDroid(21457): UNHANDLED EXCEPTION:\r\n08-18 16:38:19.130 I/MonoDroid(21457): System.ArgumentException: LayoutRenderer cannot be found: 'longdate'\r\n08-18 16:38:19.130 I/MonoDroid(21457):   at NLog.Config.Factory`2[TBaseType,TAttributeType].CreateInstance (System.String name) [0x0002c] in <filename unknown>:0 \r\n08-18 16:38:19.130 I/MonoDroid(21457):   at NLog.Layouts.LayoutParser.ParseLayoutRenderer (NLog.Config.ConfigurationItemFactory configurationItemFactory, NLog.Internal.SimpleStringReader sr) [0x00014] in <filename unknown>:0 \r\n08-18 16:38:19.130 I/MonoDroid(21457):   at NLog.Layouts.LayoutParser.CompileLayout (NLog.Config.ConfigurationItemFactory configurationItemFactory, NLog.Internal.SimpleStringReader sr, Boolean isNested, System.String& text) [0x0009a] in <filename unknown>:0 \r\n08-18 16:38:19.130 I/MonoDroid(21457):   at NLog.Layouts.SimpleLayout.set_Text (System.String value) [0x00013] in <filename unknown>:0 \r\n08-18 16:38:19.130 I/MonoDroid(21457):   at NLog.Layouts.SimpleLayout..ctor (System.String txt, NLog.Config.ConfigurationItemFactory configurationItemFactory) [0x0000d] in <filename unknown>:0 \r\n08-18 16:38:19.130 I/MonoDroid(21457):   at NLog.Layouts.Layout.FromString (System.String layoutText, NLog.Config.ConfigurationItemFactory configurationItemFactory) [0x00000] in <filename unknown>:0 \r\n08-18 16:38:19.130 I/MonoDroid(21457):   at NLog.Layouts.Layout.FromString (System.String layoutText) [0x00006] in <filename unknown>:0 \r\n08-18 16:38:19.130 I/MonoDroid(21457):   at NLog.Layouts.Layout.op_Implicit (System.String text) [0x00000] in <filename unknown>:0 \r\n08-18 16:38:19.130 I/MonoDroid(21457):   at NLog.Targets.TargetWithLayout..ctor () [0x00006] in <filename unknown>:0 \r\n08-18 16:38:19.130 I/MonoDroid(21457):   at NLog.Targets.TargetWithLayoutHeaderAndFooter..ctor () [0x00000] in <filename unknown>:0 \r\n08-18 16:38:19.130 I/MonoDroid(21457):   at NLog.Targets.ConsoleTarget..ctor () [0x00000] in <filename unknown>:0 \r\n```\r\n- Are there any work arrounds? \r\n-- Perhaps using the xml configuration, but I cannot get that to work.\r\n- Is there a version in which it did worked? \r\n-- I tried 4.3.6 to no avail.\r\n\r\nIt seems that NLog fails on creating the default ``ConsoleTarget`` ``Layout``. The same thing occurs for other ``Target``s, tested with ``DebuggerTarget``.\r\nNLog was installed using NuGet, Xamarin.Forms has version 2.3.1.114."},"comment":{"url":"https://api.github.com/repos/NLog/NLog/issues/comments/248654335","html_url":"https://github.com/NLog/NLog/issues/1599#issuecomment-248654335","issue_url":"https://api.github.com/repos/NLog/NLog/issues/1599","id":248654335,"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":"2016-09-21T15:47:58Z","updated_at":"2016-09-21T15:47:58Z","body":"I will look into it today. Thanks for the reminder"}}
{"actor":{"display_login":"304NotModified"}}