AsyncWrapper not flushing on app exit.

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

AsyncWrapper not flushing on app exit.

DCastenholz
It appears that the AsyncWrapper target does not flush any buffered messages when an application exits.  Anyone know of a workaround?
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: AsyncWrapper not flushing on app exit.

Benji
Can you subscibe to the application exit event and in the handler actually delay the application closing for the length of time it would take for the buffer to flush? Not ideal I know but a workaround none the less. ideally be nice to force a flush of the buffer on application exit or NLog did it itself.

B.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: AsyncWrapper not flushing on app exit.

ronald
In reply to this post by DCastenholz
BufferedWrapper does flush on exit. So it should not be too hard to implement in Async also, I guess.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: AsyncWrapper not flushing on app exit.

ligos
I ran into this problem as well. My Stackoverflow post below details the (one line) fix.

http://stackoverflow.com/questions/10492720/should-nlog-flush-all-queued-messages-in-the-asynctargetwrapper-when-flush-is/10508571#10508571

Note that I didn't test what happens when the LogManager.Flush() timeout is exceeded.
Loading...