[slf4j-user] Expressions on log statements to avoid log guading
Chris Pratt
thechrispratt at gmail.com
Thu Sep 12 17:25:09 CEST 2013
Oh, I just figured out where you think the NoSuchMethodExceptions will come
from, the message format strings. No, you should never get any exceptions
from the Log package, they are caught and quietly ignored. The
placeholders that they refer to will be empty and your program will
continue without any interruption. For me, and many I work with, the
possibility that a method will have been renamed while we weren't looking
is a lot less important than the performance of our product when the logs
are turned down. It's a trade off for sure, but one many are willing to
make.
(*Chris*)
On Thu, Sep 12, 2013 at 8:20 AM, Chris Pratt <thechrispratt at gmail.com>wrote:
> Hmmm, I'm not sure I follow you... isDebugEnabled() is not a compile-time
> check, it's a run-time check, and in fact, is the first thing that
> Anodyzed's Log.debug() method does. It's efficiency comes from the fact
> that Java doesn't have to assemble the log message that will be thrown away
> every time that isDebugEnabled() returns false. I'm not sure where the
> NoSuchMethodExceptions are coming from in your example?
> (*Chris*)
>
>
> On Thu, Sep 12, 2013 at 12:27 AM, coldserenity <rmuntyan at softserveinc.com>wrote:
>
>> At first glance this is indeed a cool feature allowing to remove large
>> amount
>> of isSomethingEnabled code, this also brings a HUGE threat: you don't have
>> compile-time check any more.
>>
>> And when at some time having a production issue, you enable your DEBUG
>> logs,
>> instead of solving the original issue you might get another one: logs
>> floated with NoSuchMethodException.
>>
>> Without at least proper IDE support, I'd rather not use it.
>>
>>
>>
>> --
>> View this message in context:
>> http://slf4j.42922.n3.nabble.com/Expressions-on-log-statements-to-avoid-log-guading-tp4025601p4025604.html
>> Sent from the slf4j - user mailing list archive at Nabble.com.
>> _______________________________________________
>> slf4j-user mailing list
>> slf4j-user at qos.ch
>> http://mailman.qos.ch/mailman/listinfo/slf4j-user
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.qos.ch/pipermail/slf4j-user/attachments/20130912/79a6d10e/attachment.html>
More information about the slf4j-user
mailing list