Search code examples
c#.netwcfasynchronousnlog

Is "Async" keyword the only requirement to make NLog logging asynchronous?


I am writing to a target database. In my targets section, I have marked async as true. Do I still need to write code to my web service to make logging async or framework takes care of it?

<targets async="true">

Solution

  • Yes, only the async attribute is needed (in your config)

    The async keyword in C# isn't needed.

    PS: Be aware that the async attribute will discard by default if you write more then 10000 events in a short time. If you need more control, then use the asyncWrapper instead of the async attribute. See docs