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

[Issue 306] Change connection failed warn log to error and print error message #309

Merged
merged 3 commits into from
Jul 14, 2020

Conversation

liangyuanpeng
Copy link
Contributor

@liangyuanpeng liangyuanpeng commented Jul 6, 2020

Fixes #306

Motivation

Explain here the context, and why you're making that change. What is the problem you're trying to solve.

Modifications

Print a clean log when the connection failed.

Copy link
Member

@wolfstudy wolfstudy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The change LGTM+1, just a little comment, please fix them.

@wolfstudy wolfstudy added this to the 0.2.0 milestone Jul 6, 2020
@@ -287,8 +287,8 @@ func (c *connection) doHandshake() bool {
c.cnx.SetDeadline(time.Time{})

if cmd.Connected == nil {
c.log.Warnf("Failed to perform initial handshake - Expecting 'Connected' cmd, got '%s'",
cmd.Type)
c.log.Errorf("Failed to perform initial handshake - Expecting 'Connected' cmd, got '%s'",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

About log level I think Warnf is more appropriate, it has not reached the Error level

Copy link
Contributor Author

@liangyuanpeng liangyuanpeng Jul 6, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your code review!

How do we define the error level ? The client can't working when this error happend and why just got warn log?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The message itself need to be changed though. It was basically a "debug" message. In this case, the user doesn't know what's a Connected cmd.

@@ -288,7 +288,7 @@ func (c *connection) doHandshake() bool {

if cmd.Connected == nil {
c.log.Warnf("Failed to perform initial handshake - Expecting 'Connected' cmd, got '%s'",
cmd.Type)
cmd.Error.GetMessage())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change the original message since with this change it wouldn't make sense anymore:

c.log.Warnf("Failed to establish connection with broker: '%s'",

Copy link
Member

@wolfstudy wolfstudy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM +1

@wolfstudy wolfstudy merged commit 5fea0e8 into apache:master Jul 14, 2020
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.

Should clear Error/Warn log
3 participants