Skip to content

Commit

Permalink
Merge pull request #732 from Icinga/set-mysql-cfg-logger
Browse files Browse the repository at this point in the history
Register mysql default logger prior to `mysql#NewConfig()`
  • Loading branch information
julianbrost authored Apr 9, 2024
2 parents 0daca8b + c7162e5 commit d91dc1e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pkg/config/database.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ func (d *Database) Open(logger *logging.Logger) (*icingadb.DB, error) {

config.User = d.User
config.Passwd = d.Password
config.Logger = icingadb.MysqlFuncLogger(logger.Debug)

if d.isUnixAddr() {
config.Net = "unix"
Expand Down Expand Up @@ -71,8 +72,6 @@ func (d *Database) Open(logger *logging.Logger) (*icingadb.DB, error) {
}
}

_ = mysql.SetLogger(icingadb.MysqlFuncLogger(logger.Debug))

c, err := mysql.NewConnector(config)
if err != nil {
return nil, errors.Wrap(err, "can't open mysql database")
Expand Down

0 comments on commit d91dc1e

Please sign in to comment.