From 1019b0ed9112e8f16b52e539a72349ac3eacbb8b Mon Sep 17 00:00:00 2001 From: Will Donnelly Date: Tue, 8 Oct 2024 16:12:38 -0500 Subject: [PATCH] source-mysql: More connection error logging I hate this TLS vs non-TLS connection retrying thing and how it results in two distinct errors, let's just make sure to log both so I can at least figure out what went wrong in all cases. --- source-mysql-batch/main.go | 1 + source-mysql/main.go | 1 + 2 files changed, 2 insertions(+) diff --git a/source-mysql-batch/main.go b/source-mysql-batch/main.go index 6f5b0c904..3e230551e 100644 --- a/source-mysql-batch/main.go +++ b/source-mysql-batch/main.go @@ -91,6 +91,7 @@ func connectMySQL(ctx context.Context, cfg *Config) (*client.Conn, error) { log.WithField("addr", cfg.Address).Info("connected without TLS") conn = connWithoutTLS } else { + log.WithFields(log.Fields{"withTLS": errWithTLS, "nonTLS": errWithoutTLS}).Error("unable to connect to database") var mysqlErr *mysql.MyError if errors.As(errWithTLS, &mysqlErr) && mysqlErr.Code == mysql.ER_ACCESS_DENIED_ERROR { return nil, cerrors.NewUserError(mysqlErr, "incorrect username or password") diff --git a/source-mysql/main.go b/source-mysql/main.go index f6b942ddc..ef5d24406 100644 --- a/source-mysql/main.go +++ b/source-mysql/main.go @@ -222,6 +222,7 @@ func (db *mysqlDatabase) connect(_ context.Context) error { logrus.WithField("addr", address).Info("connected without TLS") db.conn = connWithoutTLS } else { + logrus.WithFields(logrus.Fields{"withTLS": errWithTLS, "nonTLS": errWithoutTLS}).Error("unable to connect to database") var mysqlErr *mysql.MyError if errors.As(errWithTLS, &mysqlErr) && mysqlErr.Code == mysql.ER_ACCESS_DENIED_ERROR { return cerrors.NewUserError(mysqlErr, "incorrect username or password")