Collin Peterson created LOG4NET-692:
---------------------------------------

             Summary: No way to check if logs done before calling 
Logger.Repository.Shutdown()
                 Key: LOG4NET-692
                 URL: https://issues.apache.org/jira/browse/LOG4NET-692
             Project: Log4net
          Issue Type: Bug
          Components: Appenders
    Affects Versions: 2.0.14
         Environment: Visual Studio 2022, C#, Version 2.0.15 (Most recent NuGet 
version, but not listed here)
            Reporter: Collin Peterson


I must programmatically create and delete loggers using custom headers, 
footers, and file names for each created, hence why I can't use the .config 
file. When calling .Logger.Repository.Shutdown() immediately after logging a 
large amount, the last of the logs do not get added before it is shutdown. The 
simplest solution is to add Thread.Sleep(1000) before calling .Shutdown() which 
_should_ give enough time to finish. However, a better solution is an event for 
when the last of the logs are done, or a "logs to add" count (a while() loop 
would wait for count == 0), or simplest of all for users is just passing a bool 
to .Shutdown() that specifies if it should wait for logs to finish before 
shutting down.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to