Closed thisLambo closed 6 years ago
Closed because I thought the issue was with my code. Wrapped a line of code talking to log4net in a Task.Run() and the issue went away. The issue still exists.
I agree that that Task.Run may correct the issue but this should probably be updated further:
protected override async void Append(LoggingEvent loggingEvent) This should probably be changed to async task so that the async / await manager knows when it is completed.
@nezoic
A better workaround I found was to use https://github.com/cjbhaines/Log4Net.Async and wrap the HttpAppender with that. It still isn't as nice as having the GelfHttpAppender
handle it though.
My ASP.NET WepAPI application is making use of the HttpAppender for logging.
The issue I am encountering is that on two of my web methods, the calls result in:
[InvalidOperationException]: An asynchronous module or handler completed while an asynchronous operation was still pending.
which is related to this issue: https://stackoverflow.com/questions/15060214/web-api-httpclient-an-asynchronous-module-or-handler-completed-while-an-async
And can be seen here: GelfHttpAppender.cs
The commented out code would possibly resolve the issue since I don't think the
AppenderSkeleton
supportsAppend
as returning aTask
.