The FileTarget in NLog has a property (bool) called "keepFileOpen". By default, this property is set to false, which means that each log event will open a file, write to a file, and close the file.
The performance hit is huge, so I pointed "keepFileOpen" to true, not false, which means the file will be opened only once.
Does anyone have an idea (or just know) why this property is set to false by default, and does HOGGE performance affect the recording?
Are there any scenarios when setting this property to true can cause problems (therefore, it would be wise to default to false).
Thanks!
EDIT
Performance measurements for the basic layout, writing 100K events to the log:
- keepFileOpen = false (default): ~ 101 s
- keepFileOpen = true: ~ 1 s
source share