apiclient: don't log at error level when dialing #6830

Merged
merged 1 commit into from Jan 18, 2017

Conversation

Projects
None yet
4 participants
Owner

rogpeppe commented Jan 18, 2017

PR #6620 changed the client logging so that it logs an
error when it can't connect to an API address.
It is common for these errors to occur when connecting
even though the actual connect succeeds, so this
PR changes the logging to debug level - it's part
of the implementation but not something that users
should always see.

small tweaks

api/apiclient.go
return conn, nil
}
- if isX509Error(err) {
+ if certErr := isX509Error(err); !a.HasNext() || certErr {
@jameinel

jameinel Jan 18, 2017

Owner

isCertErr would be a clearer variable name to not make you think that this was an error object, but is a boolean.

api/apiclient.go
- }
- if !a.HasNext() {
- logger.Errorf("error dialing %q: %v", cfg.Location, err)
+ logger.Debugf("error dialing %q (certificate error %v): %v", certErr, err)
@jameinel

jameinel Jan 18, 2017

Owner

what do you think about:
detail := ""
if isCertErr {
detail = " (bad certificate)"
}
logger.Debugf("error dialing %q%s: %v", cfg.Location, detail, err)

apiclient: don't log at error level when dialing
PR #6620 changed the client logging so that it logs an
error when it can't connect to an API address.
It is common for these errors to occur when connecting
even though the actual connect succeeds, so this
PR changes the logging to debug level - it's part
of the implementation but not something that users
should always see.
Owner

rogpeppe commented Jan 18, 2017

$$merge$$

Contributor

jujubot commented Jan 18, 2017

Status: merge request accepted. Url: http://juju-ci.vapour.ws:8080/job/github-merge-juju

@jujubot jujubot merged commit 0abde22 into juju:develop Jan 18, 2017

1 check passed

github-check-merge-juju Built PR, ran unit tests, and tested LXD deploy. Use !!.*!! to request another build. IE, !!build!!, !!retry!!
Details

jujubot added a commit that referenced this pull request Feb 6, 2017

Merge pull request #6926 from rogpeppe/124-no-error-logging-on-failed…
…-dial-2.1

apiclient: don't log at error level when dialing

PR #6620 changed the client logging so that it logs an
error when it can't connect to an API address.
It is common for these errors to occur when connecting
even though the actual connect succeeds, so this
PR changes the logging to debug level - it's part
of the implementation but not something that users
should always see.

This is a backport of #6830 to Juju 2.1, as the errors
are confusing people and 2.2 won't be out for a while.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment