Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Update DefaultProvider.java #501

Merged
merged 3 commits into from
Aug 8, 2017
Merged

Conversation

aetheren
Copy link
Contributor

@aetheren aetheren commented Aug 7, 2017

目前,当服务发生NPE之类的错误时,没有stack trace很难进行问题定位。将exception本身也计入log可以在服务发生错误时,更清晰的定位问题。

//服务发生错误时,有机会显示stack trace
@rayzhang0603
Copy link
Collaborator

rayzhang0603 commented Aug 8, 2017

非常感谢,这块的日志确实需要优化一下。
建议在if else条件外进行log,这样无论是否有cause都可以打印异常栈。并且throwable下也请帮忙打上日志以及对应的请求,方便排查问题。 大概如下

catch (Exception e) {
    LoggerUtil.error("Exception caught when method invoke. request:" + request.toString(), e);
     ....
}catch (Throwable t) {
     LoggerUtil.error("Throwable caught when method invoke. request:" + request.toString(), e);
     ....
}

服务方法发生错误时,优化日志
@aetheren
Copy link
Contributor Author

aetheren commented Aug 8, 2017

已经按照上述进行了修改 :)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants