{"action":"created","issue":{"url":"https://api.github.com/repos/NLog/NLog/issues/245","labels_url":"https://api.github.com/repos/NLog/NLog/issues/245/labels{/name}","comments_url":"https://api.github.com/repos/NLog/NLog/issues/245/comments","events_url":"https://api.github.com/repos/NLog/NLog/issues/245/events","html_url":"https://github.com/NLog/NLog/issues/245","id":17127958,"number":245,"title":"File target doesn't duplicate header in archived files","user":{"login":"johnnyjob","id":5076492,"avatar_url":"https://avatars.githubusercontent.com/u/5076492?v=3","gravatar_id":"","url":"https://api.github.com/users/johnnyjob","html_url":"https://github.com/johnnyjob","followers_url":"https://api.github.com/users/johnnyjob/followers","following_url":"https://api.github.com/users/johnnyjob/following{/other_user}","gists_url":"https://api.github.com/users/johnnyjob/gists{/gist_id}","starred_url":"https://api.github.com/users/johnnyjob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johnnyjob/subscriptions","organizations_url":"https://api.github.com/users/johnnyjob/orgs","repos_url":"https://api.github.com/users/johnnyjob/repos","events_url":"https://api.github.com/users/johnnyjob/events{/privacy}","received_events_url":"https://api.github.com/users/johnnyjob/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/up-for-grabs","name":"up-for-grabs","color":"5319e7"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/NLog/NLog/milestones/3","html_url":"https://github.com/NLog/NLog/milestones/3.0","labels_url":"https://api.github.com/repos/NLog/NLog/milestones/3/labels","id":421067,"number":3,"title":"3.0","description":"Support for Silverlight 2 and 3, Compact Framework (all versions), NLogC and .NET 2.0 will be dropped","creator":{"login":"Xharze","id":498258,"avatar_url":"https://avatars.githubusercontent.com/u/498258?v=3","gravatar_id":"","url":"https://api.github.com/users/Xharze","html_url":"https://github.com/Xharze","followers_url":"https://api.github.com/users/Xharze/followers","following_url":"https://api.github.com/users/Xharze/following{/other_user}","gists_url":"https://api.github.com/users/Xharze/gists{/gist_id}","starred_url":"https://api.github.com/users/Xharze/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Xharze/subscriptions","organizations_url":"https://api.github.com/users/Xharze/orgs","repos_url":"https://api.github.com/users/Xharze/repos","events_url":"https://api.github.com/users/Xharze/events{/privacy}","received_events_url":"https://api.github.com/users/Xharze/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":27,"state":"closed","created_at":"2013-09-06T13:54:04Z","updated_at":"2015-08-05T16:34:10Z","due_on":null,"closed_at":"2014-06-04T22:38:31Z"},"comments":6,"created_at":"2013-07-23T21:54:36Z","updated_at":"2015-08-06T15:57:21Z","closed_at":null,"body":"File target writes header only once. If archiving is configured it would be useful to see the header in all log files, including archives. Use this sample project to reproduce the bug: https://skydrive.live.com/redir?resid=DF959DE37F64E71D!157&authkey=!AHQsJ6pHwtx1Mbk\r\n\r\nSteps to reproduce:\r\n1. Open sample project, compile and run\r\n\r\nExpected results:\r\n- Header is included into all log files\r\n\r\nActual results:\r\n- Header is included into the first file only (Log-6756-2013-07-23.0.txt).\r\n\r\nReproduced in NLog version 2.0.0.2 for .Net 3.5 (actual binaries are included into the sample project).\r\n\r\nI suggest to make the following patch to FileTarget.Write( LogEventInfo ) method:\r\n\r\n        protected override void Write(LogEventInfo logEvent)\r\n        {\r\n            string fileName = this.FileName.Render(logEvent);\r\n            byte[] bytes = this.GetBytesToWrite(logEvent);\r\n\r\n            if (this.ShouldAutoArchive(fileName, logEvent, bytes.Length))\r\n            {\r\n                this.InvalidateCacheItem(fileName);\r\n                this.DoAutoArchive(fileName, logEvent);\r\n                \r\n    +           // FIX: The following two lines enable appending of header to each archived file.\r\n    +           this.initializedFiles.Remove( fileName );\r\n    +           this.initializedFilesCounter--;\r\n            }\r\n\r\n            this.WriteToFile(fileName, bytes, false);\r\n        }\r\n"},"comment":{"url":"https://api.github.com/repos/NLog/NLog/issues/comments/128417891","html_url":"https://github.com/NLog/NLog/issues/245#issuecomment-128417891","issue_url":"https://api.github.com/repos/NLog/NLog/issues/245","id":128417891,"user":{"login":"hariniyedururi","id":13645101,"avatar_url":"https://avatars.githubusercontent.com/u/13645101?v=3","gravatar_id":"","url":"https://api.github.com/users/hariniyedururi","html_url":"https://github.com/hariniyedururi","followers_url":"https://api.github.com/users/hariniyedururi/followers","following_url":"https://api.github.com/users/hariniyedururi/following{/other_user}","gists_url":"https://api.github.com/users/hariniyedururi/gists{/gist_id}","starred_url":"https://api.github.com/users/hariniyedururi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hariniyedururi/subscriptions","organizations_url":"https://api.github.com/users/hariniyedururi/orgs","repos_url":"https://api.github.com/users/hariniyedururi/repos","events_url":"https://api.github.com/users/hariniyedururi/events{/privacy}","received_events_url":"https://api.github.com/users/hariniyedururi/received_events","type":"User","site_admin":false},"created_at":"2015-08-06T15:57:21Z","updated_at":"2015-08-06T15:57:21Z","body":"Please find the details in the attached mail.\r\n\r\nFrom: Julian Verdurmen [mailto:notifications@github.com]\r\nSent: Wednesday, August 05, 2015 4:48 PM\r\nTo: NLog/NLog\r\nCc: Yedururi, Harini\r\nSubject: Re: [NLog] File target doesn't duplicate header in archived files (#245)\r\n\r\n\r\nSo almost the same a the unit test.\r\n\r\nThis is not full config? As I cannot see header property?\r\n\r\n—\r\nReply to this email directly or view it on GitHub<https://github.com/NLog/NLog/issues/245#issuecomment-128143307>.\r\n"}}