Skip to content
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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

MOON-CLJ
Copy link
Contributor

deps on #79

@@ -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));
Copy link
Contributor

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.

Copy link
Contributor Author

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);
Copy link
Contributor

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]

Copy link
Contributor Author

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。

@MOON-CLJ MOON-CLJ force-pushed the dev05 branch 2 times, most recently from 5e83afa to 3850172 Compare January 27, 2019 04:03
@MOON-CLJ MOON-CLJ changed the title add more log for easy debug & track connection state[WIP] add more log for easy debug & track connection state Jan 27, 2019
@MOON-CLJ MOON-CLJ assigned mckelvin and tclh123 and unassigned mckelvin and tclh123 Jan 28, 2019
@MOON-CLJ MOON-CLJ requested review from mckelvin and tclh123 January 30, 2019 09:40
@mckelvin
Copy link
Contributor

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.

@MOON-CLJ
Copy link
Contributor Author

@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。

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

Successfully merging this pull request may close these issues.

3 participants