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

Aleksandr Serbin commented on LOG4NET-589:
------------------------------------------

[^LoggerManager.cs]

Attached an example of a patch.

In the patch removed the use of the AppDomain.DomainUnload and 
AppDomain.ProcessExit event.

Instead added private internal sealed Destructor class which define destructor 
that call Shutdown function.

> Impossible to use ProcessExit event for logging needs
> -----------------------------------------------------
>
>                 Key: LOG4NET-589
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-589
>             Project: Log4net
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Aleksandr Serbin
>            Priority: Minor
>         Attachments: LoggerManager.cs, log4net_nonworking.cs, 
> log4net_working.cs
>
>
> LoggerManager use ProcessExit event to run shutdown on each 
> repository/loggers. If the user wants to use these events (ProcessExit or 
> DomainUnload) also to log own data, he will meet the problem, since 
> LoggerManager will shutdown all loggers first (log4net_nonworking.cs).
> There is a workaround when you can initialize logger in main method (showed 
> in log4net_working.cs), but then all code loses readability.
>  
>  * It would be great if LoggerManager won't use ProcessExit and DomainUnload 
> to shutdown loggers, since this event might be used in user application for 
> own needs.
>  * If you can not refuse these events, then it would be good to have a public 
> method to reregister those events. User will add own delegates first and then 
> reregister LoggerManager events.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to