{"action":"created","issue":{"url":"https://api.github.com/repos/NLog/NLog/issues/1034","labels_url":"https://api.github.com/repos/NLog/NLog/issues/1034/labels{/name}","comments_url":"https://api.github.com/repos/NLog/NLog/issues/1034/comments","events_url":"https://api.github.com/repos/NLog/NLog/issues/1034/events","html_url":"https://github.com/NLog/NLog/issues/1034","id":116558155,"number":1034,"title":"Incorrect work of option \"withException\"","user":{"login":"Pyfhon","id":1410402,"avatar_url":"https://avatars.githubusercontent.com/u/1410402?v=3","gravatar_id":"","url":"https://api.github.com/users/Pyfhon","html_url":"https://github.com/Pyfhon","followers_url":"https://api.github.com/users/Pyfhon/followers","following_url":"https://api.github.com/users/Pyfhon/following{/other_user}","gists_url":"https://api.github.com/users/Pyfhon/gists{/gist_id}","starred_url":"https://api.github.com/users/Pyfhon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pyfhon/subscriptions","organizations_url":"https://api.github.com/users/Pyfhon/orgs","repos_url":"https://api.github.com/users/Pyfhon/repos","events_url":"https://api.github.com/users/Pyfhon/events{/privacy}","received_events_url":"https://api.github.com/users/Pyfhon/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/NLog/NLog/labels/bug","name":"bug","color":"fc2929"},{"url":"https://api.github.com/repos/NLog/NLog/labels/discussion","name":"discussion","color":"006b75"}],"state":"open","locked":false,"assignee":{"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},"milestone":{"url":"https://api.github.com/repos/NLog/NLog/milestones/14","html_url":"https://github.com/NLog/NLog/milestones/4.3","labels_url":"https://api.github.com/repos/NLog/NLog/milestones/14/labels","id":1369256,"number":14,"title":"4.3","description":"","creator":{"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},"open_issues":26,"closed_issues":1,"state":"open","created_at":"2015-10-21T22:23:20Z","updated_at":"2015-11-16T03:43:35Z","due_on":null,"closed_at":null},"comments":4,"created_at":"2015-11-12T14:26:10Z","updated_at":"2015-11-16T10:12:53Z","closed_at":null,"body":"Hi\r\nNLog 4.2.0\r\nIt seems that message layout renderer always outputs stack trace if \"message\" parameter has not been set.\r\n\r\nTest code:\r\n```c#\r\nstatic void Main(string[] args)\r\n{\r\n    LogManager.GetCurrentClassLogger().Error(new Exception(\"test 1\"));\r\n    LogManager.GetCurrentClassLogger().Error(new Exception(\"test 2\"), string.Empty);\r\n}\r\n```\r\nNLog.config:\r\n```xml\r\n<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<nlog xmlns=\"http://www.nlog-project.org/schemas/NLog.xsd\"\r\n      xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\r\n\r\n\t<targets>\r\n\t\t<target xsi:type=\"File\" encoding=\"UTF-8\"\r\n            name=\"File\"\r\n            filename=\"Log.log\"\r\n            layout=\"${message:withException=true} ${exception:format=tostring}\" />\r\n\t</targets>\r\n\r\n\t<rules>\r\n\t\t<logger name=\"*\" minlevel=\"Trace\" writeTo=\"File\" />\r\n\t</rules>\r\n</nlog>\r\n```\r\nResult with 'withException=false':\r\n```\r\nSystem.Exception: test 1 System.Exception: test 1\r\n System.Exception: test 2\r\n```\r\n\r\nResult with 'withException=true':\r\n```\r\nSystem.Exception: test 1\r\nSystem.Exception: test 1 System.Exception: test 1\r\n\r\nSystem.Exception: test 2 System.Exception: test 2\r\n```"},"comment":{"url":"https://api.github.com/repos/NLog/NLog/issues/comments/156978214","html_url":"https://github.com/NLog/NLog/issues/1034#issuecomment-156978214","issue_url":"https://api.github.com/repos/NLog/NLog/issues/1034","id":156978214,"user":{"login":"Pyfhon","id":1410402,"avatar_url":"https://avatars.githubusercontent.com/u/1410402?v=3","gravatar_id":"","url":"https://api.github.com/users/Pyfhon","html_url":"https://github.com/Pyfhon","followers_url":"https://api.github.com/users/Pyfhon/followers","following_url":"https://api.github.com/users/Pyfhon/following{/other_user}","gists_url":"https://api.github.com/users/Pyfhon/gists{/gist_id}","starred_url":"https://api.github.com/users/Pyfhon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pyfhon/subscriptions","organizations_url":"https://api.github.com/users/Pyfhon/orgs","repos_url":"https://api.github.com/users/Pyfhon/repos","events_url":"https://api.github.com/users/Pyfhon/events{/privacy}","received_events_url":"https://api.github.com/users/Pyfhon/received_events","type":"User","site_admin":false},"created_at":"2015-11-16T10:12:53Z","updated_at":"2015-11-16T10:12:53Z","body":"The problem is that when the option `withException = true` $ {message} output 2 identical message `exception.ToString()`.\r\n\r\nTo solve this problem, I see two options.\r\nThe first - to use a special case for exceptions (not see anything wrong, partly because it is being used as a `logEvent.Exception = ex`).\r\nThe second - completely separate calls `Log(exception)` and `Log(object)` in the form of method overloading.\r\n\r\n"}}