keepFileOpen=true on <target>

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

keepFileOpen=true on <target>

alexf2
Hi, guys!

I set
  <target name="CqgAgentLogs" xsi:type="File" fileName="${agentLogs}/${logger}.log"  keepFileOpen="true" autoFlush="true" />

but, for sync loggers I see nothing in the LOG file until the AppDomain terminates. Logging works fine with keepFileOpen="false".
But, with keepFileOpen="true" NLog doesn't flush the logged data each time logging occures.

With async wrapper and keepFileOpen="true" it flushes the data.
<target name="file" xsi:type="AsyncWrapper">
    <target name="CqgAgentLogs" xsi:type="File" fileName="${agentLogs}/${logger}.log"  keepFileOpen="true" autoFlush="true" />
</target>
Without async wrapper and keepFileOpen="true" it doesn't flush the data.

I wonder why NLog doesn't flush the data inspite of autoFlush="true"?
I use NLog 2.0 release.
Reply | Threaded
Open this post in threaded view
|

Re: keepFileOpen=true on <target>

Samuel13
I've noticed exactly the same behaviour.

(Also with NLog 2.0 release)