Skip to content

File target - keepFileOpen: file is not recreated if deleted manually. #1856

@irs-thba1

Description

@irs-thba1

Type: Bug
NLog version: 4.3.4
Platform: .Net 4.5

I have configured a file target:
<target name="myFileTarget" xsi:type="File" fileName="${event-properties:item=myFileDir}\${event-properties:item=myFile}" layout="${message}" cleanupFileName="false" autoFlush="false" concurrentWrites="false" keepFileOpen="true"> </target>

When 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.

I expect that the file is recreated when it does no longer exist. If I set keepFileOpen = "false" this is the case.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions