You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Dominik Psenner (JIRA)" <ji...@apache.org> on 2018/01/10 23:57:01 UTC

[jira] [Commented] (LOG4NET-501) Finalization of appenders might fail

    [ https://issues.apache.org/jira/browse/LOG4NET-501?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16321380#comment-16321380 ] 

Dominik Psenner commented on LOG4NET-501:
-----------------------------------------

A lot of time has passed by since this issue was opened. I tried just now to figure out how and where the finalization happens and found that this is a rather complex thing. Would you explain your findings?

> Finalization of appenders might fail
> ------------------------------------
>
>                 Key: LOG4NET-501
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-501
>             Project: Log4net
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 1.2.10
>            Reporter: Matthias Hess
>
> Given the following example:
> {code}
>             LogLog.InternalDebugging = true;
>             RollingFileAppender result = new RollingFileAppender();
>             result.File = ...;
>             result.AppendToFile = true;
>             result.Encoding = Encoding.UTF8;
>             ...
>             result.ActivateOptions();
> {code}
> 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?



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)