-
Notifications
You must be signed in to change notification settings - Fork 76
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add more log for easy debug & track connection state #92
base: master
Are you sure you want to change the base?
Conversation
@@ -41,6 +41,7 @@ err_code_t Client::get(const char* const* keys, const size_t* keyLens, size_t nK | |||
dispatchRetrieval(GET_OP, keys, keyLens, nKeys); | |||
err_code_t rv = waitPoll(); | |||
collectRetrievalResult(results, nResults); | |||
log_info_if(rv != RET_OK, "[I: %p], err code %s", this, errCodeToString(rv)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAICS, it's no need to add log here, because the user can get rv
and client
outside.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tclh123 also because pointer address。
if (m_deadUntil > 0) { | ||
log_info("Connection %s is back to live at %lu", m_name, now); | ||
} | ||
log_info_if(m_deadUntil > 0, "[I: %p] %s is back to live at %lu", this, m_name, now); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Connection m_name
seems better than [I: pointer]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tclh123 https://github.com/douban/libmc/blob/master/src/Connection.cpp#L49-L52 m_name is "host:port" or alias。it's readable。but when need to debug & track reconnecting,pointer address is useful。
5e83afa
to
3850172
Compare
Could you add more details on why we need this? I know this is good, but we need background and reasons to help us track down issues. |
@mckelvin this pr add some log in info level。specially, pointer address of "this" is new。pointer address is useful to track reconnecting,host:port or alias is not enough。these logs help us discover the recv_error issue cause by server kick connections because of idle_timeout。 |
deps on #79