Tencent / TubeMQ

TubeMQ has been donated to the Apache Software Foundation and renamed to InLong, please visit the new Apache repository: https://github.com/apache/incubator-inlong

Home Page:https://inlong.apache.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Remove redundant exception information log print and amend LOG level bug

aloyszhang opened this issue · comments

Currently ,there are some redundant exception information print like :

catch (Exception e) {
            e.printStackTrace();
            logger.info("[loadTopicConfUnits error] ", e);
            throw e;
        }

And, some LOG level error like :

catch (Throwable t) {
            logger.info("Dispatcher start failed!", t);
            throw new ServletException(t);
        }

These are really places that needs to be aligned and modified. Can you mention a pr to see the specific modification point?

commented

Thanks for reporting this issue. In my opinion

catch (Exception e) {
            e.printStackTrace();
            logger.info("[loadTopicConfUnits error] ", e);
            throw e;
        }

we might be able to reduce e.printStackTrace() because stack trace is already logged by logger. The subtle difference is that e.printStackTrace() print stack trace in STDOUT. @gosonzhang please check whether our users rely on STDOUT output.

catch (Throwable t) {
            logger.info("Dispatcher start failed!", t);
            throw new ServletException(t);
        }

though usually we log exception in debug/warn/error level, Logger#info can also log exception as other level does. Here the concern is that change to warn might flood user log monitor if these logs are too much.

However, if you open a pull request for this kind of changes, we can deal with them case by case.

@tisonkun Thanks for you reply.
I agree with that Logger#info can also log exception as other level does.
However , these several places of Logger#info means some error when loading master meta data from BDB StoreUnit.
So I think use Logger#error is the better way.

commented

Thanks for your explanation @aloyszhang ! Good contribution :-)