[
https://issues.apache.org/jira/browse/LOG4NET-400?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13792573#comment-13792573
]
Gian Marco Gherardi edited comment on LOG4NET-400 at 10/11/13 12:46 PM:
------------------------------------------------------------------------
I think the greatest flexibility would be to expose a method like the one found
in CommonLogging
(http://netcommon.sourceforge.net/docs/2.1.0/reference/html/ch01.html#logging-usage)
{code}
log.Debug( m => m("my expensive to calculate argument is: {0}",
CalculateMessageInfo()) );
{code}
Meaning thet the lambda mixes in string.Format functionality found in ILog.
With the current {{ILogExtensionsMethods}} implementation the same code must be
written like this:
{code}
log.DebugExt( () => string.Format("my expensive to calculate argument is: {0}",
CalculateMessageInfo()) );
{code}
Why not just porting CommonLogging implementation into Log4Net?
was (Author: gimmi):
I think the greatest flexibility would be to expose a method like the one found
in CommonLogging
(http://netcommon.sourceforge.net/docs/2.1.0/reference/html/ch01.html#logging-usage)
{code}
log.Debug( m => m("my expensive to calculate argument is: {0}",
CalculateMessageInfo()) );
{code}
Meaning thet the lambda mixes in string.Format functionality found in ILog.
With the current {{ILogExtensionsMethods}} implementation the same code must be
written like this:
{code}
log.DebugExt( () => string.Format("my expensive to calculate argument is: {0}",
CalculateMessageInfo()) );
{code}
> ILog extension methods doesnt work as expected
> ----------------------------------------------
>
> Key: LOG4NET-400
> URL: https://issues.apache.org/jira/browse/LOG4NET-400
> Project: Log4net
> Issue Type: Improvement
> Reporter: Gian Marco Gherardi
>
> Hi, I'm trying the feature LOG4NET-290, but seems that the following format
> doesn't work:
> log.Debug( m=>m("value= {0}", obj.Value) );
> Instead this seems the correct signature:
> log.Debug(() => string.Format("value= {0}", obj.Value));
> That is not as convenient IMO. Another thing I've noticed is that there are
> also many extension methods that merely proxy the methods already supported
> by plain ILog. What's the reason for that? I mean ILog methods already skip
> logging if level is not active.
--
This message was sent by Atlassian JIRA
(v6.1#6144)