You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Vikas Singh (Jira)" <ji...@apache.org> on 2021/11/03 23:16:00 UTC

[jira] [Commented] (KAFKA-13432) ApiException should provide a way to capture stacktrace

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

Vikas Singh commented on KAFKA-13432:
-------------------------------------

One simple solution can be to fill in the stacktrace based on log level, so something like this:
{code:java}
    /* avoid the expensive and useless stack trace for api exceptions */
    @Override
    public Throwable fillInStackTrace() {
        if (LOG.debugEnabled()) {
            return super.fillInStackTrace()
        } else { 
            return this;
        }
    }
{code}

> ApiException should provide a way to capture stacktrace
> -------------------------------------------------------
>
>                 Key: KAFKA-13432
>                 URL: https://issues.apache.org/jira/browse/KAFKA-13432
>             Project: Kafka
>          Issue Type: Improvement
>          Components: core
>            Reporter: Vikas Singh
>            Priority: Major
>
> ApiException doesn't fill in the stacktrace, it overrides `fillInStacktrace` to make it a no-op, here is the code: https://github.com/apache/kafka/blob/trunk/clients/src/main/java/org/apache/kafka/common/errors/ApiException.java#L45,L49
> However, there are times when full stacktrace will be helpful in finding out what went wrong on the client side. We should provide a way to make this behavior configurable, so that if an error is hit multiple times, we can switch the behavior and find out what code is causing it.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)