I'm interested in this as I've also written an async appender.  Mine is 
currently lossy both at application shutdown and when the application floods it 
with events faster than it can process them, so to date I haven't been too 
concerned by this issue.

Do you have an MCVE (http://stackoverflow.com/help/mcve) for the problem you 
describe in your StackOverflow post?   If so I'd be happy to take a look.

Log4net already exposes a shutdown routine (LogManager.Shutdown()).  If pull 
request #37 (https://github.com/apache/log4net/pull/37) is implemented, your 
app could also call LogManager.Flush at shutdown.

A comment in RemotingAppender.OnClose, which is asynchronous, implies that 
queued background threads may not complete if called from the ProcessExit event 
(total execution time of ProcessExit event handlers limited to 2 seonds by 
default).


From: Nicholas Duane [mailto:nic...@msn.com]
Sent: 16 October 2016 04:23
To: Log4NET User
Subject: Re: Apache log4net Needs Help


By the way, what's the state of async appenders in log4net?  I ask because the 
guys pushing nlog over here say that one reason they like nlog is that is 
allows for async operation.  I assumed log4net supports that also, however when 
I attempted to do some async stuff in log4net I did run into problems:



http://stackoverflow.com/questions/36344822/log4net-appenders-onclose-doesnt-seem-to-work



Seems like log4net should not only expose a startup routine the app must call 
but also a shutdown routine, and indicate that it's essential it gets called.  
Then log4net could shutdown the appenders in the shutdown routine as opposed to 
relying on .NET's appdomain shutdown logic.



Thanks,

Nick

Reply via email to