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

Gian Marco Gherardi commented on LOG4NET-394:
---------------------------------------------

Every exception raised during log processing is silenced. This code, for 
example, does not throw exceprtion:

{code}
class Program
{
    static void Main(string[] args)
    {
        BasicConfigurator.Configure();
        LogManager.GetLogger("Logger").FatalFormat("{0}", new Message());
    }
}

class Message
{
    public override string ToString()
    {
        throw new ApplicationException();
    }
}
{code}

IMO catching application raised by the lambda is more coherent with the rest of 
the framework.

> Lambda-based ILog-Extensions should catch errors
> ------------------------------------------------
>
>                 Key: LOG4NET-394
>                 URL: https://issues.apache.org/jira/browse/LOG4NET-394
>             Project: Log4net
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 1.2.12
>            Reporter: Gian Marco Gherardi
>            Priority: Minor
>
> The new lambda syntax introduced with LOG4NET-290 allow wrapping log related 
> code in a lambda to be executed only if necessary. In the log4net spirit of 
> being a reliable logging system (see 
> http://logging.apache.org/log4net/release/faq.html) also the log related code 
> contained in the lambda should not block application by throwing exception 
> and so the lambda execution shluld be wrapped in a try...catch



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Reply via email to