hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Doug Cutting (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HADOOP-6884) Add LOG.isDebugEnabled() guard for each LOG.debug("...")
Date Thu, 26 Aug 2010 19:16:54 GMT

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

Doug Cutting commented on HADOOP-6884:

> SLF4J [ ...]  has the regular method void debug(String msg) so people will just use it
as they did before.

Not if we have an automated test that looks for string concatenation in log statements.  That's
required for your proposal too, no?

> Migrating to SLF4J will mean changing logging for all levels in the entire project(s).

SLF4J wraps log4j, just like commons logging.  So existing log configuration & format
should be unaffected.

> creating extra object[] is a performance problem

No performance problems have actually been identified.  Some have been suggested, but none
shown to be significant in real operations.

That said, micro-benchmarks show that, were there a performance problem, getting rid of string
concatenation would reduce the impact of logging by around 90%.  Removing Object[] allocation
would improve it further, but it's not clear, given that even that the string concatenation
has not shown to be significant, that this would be a significant improvement.  Plus, the
majority of log statements have a single parameter and would not require an Object[] allocation.
 So, unless someone can show that Object[] allocation in multi-parameter log statements is
slowing things significantly, slf4j would suffice.

> 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