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

Finalization of appenders might fail

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.10
    • Fix Version/s: None
    • Component/s: Core
    • Labels:
      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

            • Assignee:
              Unassigned
              Reporter:
              m.hess Matthias Hess
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: