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

Eric Yang commented on HDDS-1833:
---------------------------------

[~swagle] Thank you for patch 002.  Unfortunately, this doesn't quite work as I 
intended.  Sorry for the mislead in option 1.  The output may turns out to be:

{code}
java.lang.Thread.getStackTrace(Thread.java:1559)
{code}

h3. Option 2 

This will give one liner output of the current stack:

{code}
LOG.trace("DecRef {} to refCnt {}, stackTrace: {}", containerDBPath,
        referenceCount.get(), new Throwable().getStackTrace());
{code}

Output:

{code}
DecRef /test to 0, stackTrace: 
org/apache/hadoop/ozone/container/common/utils/ReferenceCountedDB. 
decrementReference(ReferenceCountedDB.java:64)
{code}

h3. Option 3

If you want a full stack trace, solution is:

{code}
import org.apache.commons.lang3.exception.ExceptionUtils;
...
LOG.trace("DecRef {} to refCnt {}, stackTrace: {}", containerDBPath,
        referenceCount.get(), ExceptionUtils.getStackTrace(new Throwable());
{code}

Option 2 is better to know where the line of code originated.
Option 3 is useful to list the full stack.

> 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, HDDS-1833.02.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: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to