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] [Comment Edited] (LOG4NET-394) Lambda-based ILog-Extensions should catch errors
Date Thu, 03 Oct 2013 11:17:42 GMT

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

Dominik Psenner edited comment on LOG4NET-394 at 10/3/13 11:16 AM:
-------------------------------------------------------------------

What do you expect to happen if you write this somewhere in your application:

ILog logger;
[...]
logger.DebugExt(null);

or

ILog logger;
[...]
logger.DebugExt(() => 123/0);

As I see it, log4net should not silently ignore erroneous code which is part of a lambda expression
since log4net is not responsible of the lambda expression just alike log4net is not responsible
if someone writes this:

ILog logger;
[...]
logger.Debug(123/0);

The lambda expressions passed into the logger are not part of the framework and ignoring exceptions
there may lead to one of those special cases where noone ever notices that nothing is logged
because someone wrote something silly in a lambda expression.


was (Author: nachbarslumpi):
What do you expect to happen if you write this somewhere in your application:

ILog logger;
[...]
logger.DebugExt(null);

or

ILog logger;
[...]
logger.DebugExt(() => 123/0);

As I see it, log4net should not silently ignore erroneous code which is part of a lambda expression
since log4net is not responsible of the lambda expression just alike log4net is not responsible
if someone writes this:

ILog logger;
[...]
logger.Debug(123/0);

The lambda expressions passed into the logger are not part of the framework and ignoring exceptions
there may lead to onen of those special cases where noone ever notices that nothing is logged
because someone wrote something silly in a lambda expression.

> 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)

Mime
View raw message