logging-log4net-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Dominik Psenner (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LOG4NET-537) Crash on log during AssemblyLoad event
Date Wed, 30 Nov 2016 13:01:58 GMT

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

Dominik Psenner commented on LOG4NET-537:
-----------------------------------------

We require at least a stacktrace to get a clue on what is happening here. A first guess is
that log4net has not been initialized yet when the assemblyload event is fired.

> Crash on log during AssemblyLoad event
> --------------------------------------
>
>                 Key: LOG4NET-537
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-537
>             Project: Log4net
>          Issue Type: Bug
>    Affects Versions: 1.2.15
>         Environment: Visual Studio 2013,C#, Dot.Net 4.61
> nuget  : <package id="log4net" version="2.0.5" targetFramework="net461" />
>            Reporter: Guillaume Favre
>
> Hello,
> the following code cause the program to crash.
> class Program
>     {
>         private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
>         static void Main(string[] args)
>         {
>             try
>             {
>                 AppDomain.CurrentDomain.AssemblyLoad += CurrentDomainAssemblyLoad;
>                 log4net.Config.BasicConfigurator.Configure();
>                 Exception e = new Exception("Toto");
>                 throw e;
>             }
>             catch (Exception e)
>             {
>                 Log.Error("Error ", e);
>             }
>         }
>         private static void CurrentDomainAssemblyLoad(object sender, AssemblyLoadEventArgs
args)
>         {
>             Log.Debug("COUCOU");
>         }
>     }



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message