hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Scott Carey (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HADOOP-6884) Add LOG.isDebugEnabled() guard for each LOG.debug("...")
Date Sat, 28 Aug 2010 02:04:55 GMT

    [ https://issues.apache.org/jira/browse/HADOOP-6884?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12903759#action_12903759

Scott Carey commented on HADOOP-6884:

bq.  I've got a feeling that Scott is very strong about moving Hadoop to SLF4J.

Moreso that if there was going to be a lot of work to build custom wrappers and change logging
signatures across the code-base, that SLF4J should be a strong contender since that is what
it does.   
If building such a thing is outside the scope here, then guard statements surely work.

In a blue-sky world, SLF4J (or some framework) would modify bytecode to push its guard statement
from inside its log method to around it at call sites.  But now I'm just dreaming.

I have had good experience with a proprietary logging wrapper that lowered string concatenation
churn caused by method invocations in the past -- many years before SLF4J did it -- and with
an additional 200 or so method signatures to avoid autoboxing in 99% of use cases.  A bit
ugly, but very effective and we didn't have to teach developers when or why to guard their
logging statements.

> Add LOG.isDebugEnabled() guard for each LOG.debug("...")
> --------------------------------------------------------
>                 Key: HADOOP-6884
>                 URL: https://issues.apache.org/jira/browse/HADOOP-6884
>             Project: Hadoop Common
>          Issue Type: Improvement
>    Affects Versions: 0.22.0
>            Reporter: Erik Steffl
>            Assignee: Erik Steffl
>             Fix For: 0.22.0
>         Attachments: FunAgain.java, FunAgain.java, HADOOP-6884-0.22-1.patch, HADOOP-6884-0.22.patch
> Each LOG.debug("...") should be executed only if LOG.isDebugEnabled() is true, in some
cases it's expensive to construct the string that is being printed to log. It's much easier
to always use LOG.isDebugEnabled() because it's easier to check (rather than in each case
reason whether it's necessary or not).

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message