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

Daniel Templeton commented on YARN-6166:
----------------------------------------

[~Naganarasimha], given that the arg is a fixed string, does it really make 
that much difference?  I would assume logging a message at a disabled level 
should be as cheap as checking the log level.  I'm basing my assumption off the 
JDK's logging, where I know that was an explicit goal.  I haven't looked at the 
code for the logging we use.

Looking online, though, I see that Apache commons logging only recommends the 
guard clause to avoid expensive parameter evaluation:{quote}Code guards are 
typically used to guard code that only needs to execute in support of logging, 
that otherwise introduces undesirable runtime overhead in the general case 
(logging disabled). Examples are multiple parameters, or expressions (e.g. 
string + " more") for parameters. Use the guard methods of the form 
{{log.is<Priority>() }}to verify that logging should be performed, before 
incurring the overhead of the logging method call. Yes, the logging methods 
will perform the same check, but only after resolving parameters.{quote}  I 
also see this link on Stack Overflow about Log4j: 
http://stackoverflow.com/questions/963492/in-log4j-does-checking-isdebugenabled-before-logging-improve-performance
 that says in the case of this JIRA it's better to leave out the guard clause.

> Unnecessary INFO logs in AMRMClientAsyncImpl$CallbackHandlerThread.run
> ----------------------------------------------------------------------
>
>                 Key: YARN-6166
>                 URL: https://issues.apache.org/jira/browse/YARN-6166
>             Project: Hadoop YARN
>          Issue Type: Bug
>    Affects Versions: 2.7.3
>            Reporter: Grant W
>            Assignee: Grant W
>            Priority: Trivial
>              Labels: patch
>             Fix For: 2.9.0, 3.0.0-alpha3
>
>         Attachments: YARN-6166.patch
>
>
> Logs like the following should be debug or else every legitimate stop causes 
> unnecessary exception traces in the logs.
> {noformat}
> 2013-08-03 20:01:34,460 INFO [AMRM Callback Handler Thread] 
> org.apache.hadoop.yarn.client.api.async.impl.AMRMClientAsyncImpl:       
> Interrupted while waiting for queue
>  java.lang.InterruptedException
>    at 
> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.reportInterruptAfterWait(AbstractQueuedSynchronizer.
>      java:1961)
>    at 
> java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1996)
>    at 
> java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:399)
>    at 
> org.apache.hadoop.yarn.client.api.async.impl.AMRMClientAsyncImpl$CallbackHandlerThread.run(AMRMClientAsyncImpl.java:275)
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to