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

Finalization of appenders might fail

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.2.10
    • None
    • Core
    • None

    Description

      Given the following example:

                  LogLog.InternalDebugging = true;
                  RollingFileAppender result = new RollingFileAppender();
                  result.File = ...;
                  result.AppendToFile = true;
                  result.Encoding = Encoding.UTF8;
                  ...
                  result.ActivateOptions();
      

      When this rolling file appender object gets finalized (due to no more references), the finalization code tries to close the underlying file stream. This will fail, if the underlying file stream itself was already subject to finalization.
      It gives me log4net internal error messages when using the appenders outside of a logger repository.
      I think, the current finalization code does a little too much. Writing a footer/flushing should be triggered by the AppDomain events only.
      What do you think about it?

      Attachments

        Activity

          People

            Unassigned Unassigned
            m.hess Matthias Hess
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: