Log4Net.Async icon indicating copy to clipboard operation
Log4Net.Async copied to clipboard

ParallelForwardingAppender do not mix Task and Threads

Open xmedeko opened this issue 8 years ago • 0 comments

Current implementation of ParallelForwardingAppender is wrong, since it block a thread form the default ThreadPool. The C# Tasks and Threads should not be mixed together. {{BlockingCollection}} is based on a thread synchronization (lock), so do not use it for the Task running on a ThreadPool.

The Task based producer - consumer is a bit more complicated, e.g. see Stephen Clearys's or .NET doc). Anyway, do not use tasks, since the ForwardLoggingEvent is not Task-based. (E.g. some appender sending logs by network may have long log times.) Just start a new plain thread.

See also #37

xmedeko avatar Feb 05 '18 08:02 xmedeko