Receive Log from Async Call with NLog

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

Receive Log from Async Call with NLog

marius72
Is there any possibility to send Logs from within an async call, something like the code below:

main call:
await DoSomething();

public static async Task DoSomething()
{
logger.Trace("Async Started");
await PerformAsyncCall();
logger.Trace("Async Finished");
}

NLog writes correctly to the log file and works well with Log4View when I there is NO async calls. Instead, when I use async calls, only the log file is populated, but Log4View cannot capture the log call.

Thank you
Reply | Threaded
Open this post in threaded view
|

Re: Receive Log from Async Call with NLog

Philipp Lauchner
Administrator
Dear marius72,

the following example project shows how we tried to recreate your problem. Yet we did not encounter any problems. Could you extend it to the point, where your problem occures?
AsyncLogger.zip

Yours sincerely

Philipp Lauchner
PROSA GmbH  
Development & Support