with the understanding that all logging now occurs as...">

Nlog Async and Log Sequence

In my nlog configuration I installed

<targets async="true"> 

with the understanding that all logging now occurs asynchronously with the application workflow. (and I noticed a performance improvement, especially by email). However, I was thinking of a protocol sequence. I understand that using async does not guarantee the order in which the OS will execute async. Therefore, if in my web application several requests are included in the same method, each of which registers their appearance in NLog, does this really mean that the sequence in which events are displayed in my target log chart will not necessarily be a sequence In which journal method was called by various requests?

If so, is this just a consequence of the asynchrony with which to live? Or can I do something so that my logs display the correct sequence?

+4
source share
2 answers

Unfortunately, you need to live with this. If it is important to maintain a sequence, you will have to run it synchronously.

But if you can manually save the sequence number in the log message, this might be the solution.

+3
source

I know this is old and I'm just building up NLog, but if you see a performance increase for the email client, can you just approve ASYNC for the email purpose?

0
source

All Articles