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

Eric Yang edited comment on HDDS-1833 at 7/24/19 5:16 PM:
----------------------------------------------------------

We usually don't need conditional check unless the log statement contains 
expensive computation before it can be printed.  In this case, we are simply 
concatenating two strings.  By using LOG.trace statement only and let logger 
suppress the output maybe good enough unless we want to include stacktrace.  
new Exception().printStackTrace(); will print the stacktrace to .out file.  
This might result in same related log statement sent to .out file and .log 
file.  This could be hard to correlate.  In general Hadoop does not log 
anything to .out file other than showing the current ulimit configuration.  I 
would suggest to use slf4j feature to render stacktrace in the same log 
statement.

{code}
if (LOG.isTraceEnabled()) {
      LOG.trace("DecRef {} to refCnt {}, stacktrace: {}", containerDBPath,
           referenceCount.get(), Thread.currentThread().getStackTrace());
}
{code}


was (Author: eyang):
We usually don't need conditional check unless the log statement contains 
expensive computation before it can be printed.  In this case, we are simply 
concatenating two strings.  By using LOG.trace statement only and let logger 
suppress the output is good enough.  new Exception().printStackTrace(); will 
print the stacktrace to .out file.  This means we have two duplicated output in 
the logs as well as stdout which is converted to .out log file.  In general 
Hadoop does not log anything to .out file other than showing the current ulimit 
configuration.  I would suggest to skip new Exception().printStackTrace() 
statement all together.

> RefCountedDB printing of stacktrace should be moved to trace logging
> --------------------------------------------------------------------
>
>                 Key: HDDS-1833
>                 URL: https://issues.apache.org/jira/browse/HDDS-1833
>             Project: Hadoop Distributed Data Store
>          Issue Type: Bug
>          Components: Ozone Datanode
>    Affects Versions: 0.4.0
>            Reporter: Mukul Kumar Singh
>            Assignee: Siddharth Wagle
>            Priority: Major
>              Labels: newbie
>         Attachments: HDDS-1833.01.patch
>
>
> RefCountedDB logs the stackTrace for both increment and decrement, this 
> pollutes the logs.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to