Uploaded image for project: 'Log4net'
  1. Log4net
  2. LOG4NET-692

No way to check if logs done before calling Logger.Repository.Shutdown()

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Minor
    • Resolution: Unresolved
    • 2.0.14
    • None
    • Appenders
    • None
    • Visual Studio 2022, C#, Version 2.0.15 (Most recent NuGet version, but not listed here)

    Description

      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.

      Attachments

        Activity

          People

            Unassigned Unassigned
            collin@nichebio.com Collin Peterson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: