From 2b0fad897e61400bd2a6cdf47f33ff4301e9c5f8 Mon Sep 17 00:00:00 2001 From: Patrik Date: Thu, 6 May 2021 17:01:45 +0200 Subject: [PATCH] fix: log all database connection errors (#588) --- internal/persistence/sql/persister.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/internal/persistence/sql/persister.go b/internal/persistence/sql/persister.go index 3cf42eb54..0be81f5ef 100644 --- a/internal/persistence/sql/persister.go +++ b/internal/persistence/sql/persister.go @@ -100,16 +100,17 @@ func (p *Persister) newConnection(options map[string]string) (c *pop.Connection, if err := backoff.Retry(func() (err error) { c, err = pop.NewConnection(connDetails) if err != nil { - p.l.WithError(err).Warnf("Unable to connect to database, retrying.") + p.l.WithError(err).Error("Unable to connect to database, retrying.") return errors.WithStack(err) } if err := c.Open(); err != nil { - p.l.WithError(err).Warnf("Unable to open the database connection, retrying.") + p.l.WithError(err).Error("Unable to open the database connection, retrying.") return errors.WithStack(err) } if err := c.Store.(interface{ Ping() error }).Ping(); err != nil { + p.l.WithError(err).Error("Unable to ping the database connection, retrying.") return errors.WithStack(err) }