{"action":"created","issue":{"url":"https://api.github.com/repos/NLog/NLog/issues/1856","repository_url":"https://api.github.com/repos/NLog/NLog","labels_url":"https://api.github.com/repos/NLog/NLog/issues/1856/labels{/name}","comments_url":"https://api.github.com/repos/NLog/NLog/issues/1856/comments","events_url":"https://api.github.com/repos/NLog/NLog/issues/1856/events","html_url":"https://github.com/NLog/NLog/issues/1856","id":195776404,"number":1856,"title":"File target - keepFileOpen: file is not recreated if deleted manually.","user":{"login":"thba","id":20161451,"avatar_url":"https://avatars.githubusercontent.com/u/20161451?v=3","gravatar_id":"","url":"https://api.github.com/users/thba","html_url":"https://github.com/thba","followers_url":"https://api.github.com/users/thba/followers","following_url":"https://api.github.com/users/thba/following{/other_user}","gists_url":"https://api.github.com/users/thba/gists{/gist_id}","starred_url":"https://api.github.com/users/thba/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thba/subscriptions","organizations_url":"https://api.github.com/users/thba/orgs","repos_url":"https://api.github.com/users/thba/repos","events_url":"https://api.github.com/users/thba/events{/privacy}","received_events_url":"https://api.github.com/users/thba/received_events","type":"User","site_admin":false},"labels":[{"id":302859011,"url":"https://api.github.com/repos/NLog/NLog/labels/file-target","name":"file-target","color":"ffffff","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-12-15T11:01:56Z","updated_at":"2016-12-15T17:09:47Z","closed_at":null,"body":"**Type**: Bug\r\n**NLog version**: 4.3.4\r\n**Platform**: .Net 4.5\r\n\r\nI have configured a file target:\r\n`<target name=\"myFileTarget\" xsi:type=\"File\"\r\n\tfileName=\"${event-properties:item=myFileDir}\\${event-properties:item=myFile}\"\r\n\tlayout=\"${message}\"\r\n\tcleanupFileName=\"false\"\r\n\tautoFlush=\"false\"\r\n\tconcurrentWrites=\"false\"\r\n\tkeepFileOpen=\"true\">\r\n</target>`\r\n\r\nWhen I run my application the file gets created and logged into like expected. When my application is idle (no logs are created) and I delete the logfile and then the application starts to produce logs again, the file is not re-created, the logs go to nowhere and no exception or error occures.\r\n\r\nI expect that the file is recreated when it does no longer exist. If I set keepFileOpen = \"false\" this is the case.\r\n"},"comment":{"url":"https://api.github.com/repos/NLog/NLog/issues/comments/267383976","html_url":"https://github.com/NLog/NLog/issues/1856#issuecomment-267383976","issue_url":"https://api.github.com/repos/NLog/NLog/issues/1856","id":267383976,"user":{"login":"snakefoot","id":11509660,"avatar_url":"https://avatars.githubusercontent.com/u/11509660?v=3","gravatar_id":"","url":"https://api.github.com/users/snakefoot","html_url":"https://github.com/snakefoot","followers_url":"https://api.github.com/users/snakefoot/followers","following_url":"https://api.github.com/users/snakefoot/following{/other_user}","gists_url":"https://api.github.com/users/snakefoot/gists{/gist_id}","starred_url":"https://api.github.com/users/snakefoot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/snakefoot/subscriptions","organizations_url":"https://api.github.com/users/snakefoot/orgs","repos_url":"https://api.github.com/users/snakefoot/repos","events_url":"https://api.github.com/users/snakefoot/events{/privacy}","received_events_url":"https://api.github.com/users/snakefoot/received_events","type":"User","site_admin":false},"created_at":"2016-12-15T17:09:47Z","updated_at":"2016-12-15T17:09:47Z","body":"Would be an expensive operation to re-validate FileStream for every wirte-operation.\r\n\r\nWindows allows the user to delete files, while another process has open filehandles to the file. Windows just cheats and hides the file from the user, and deletes the file correctly when all handles are closed."}}
{"actor":{"display_login":"snakefoot"}}