From 2775025677a2eb08f0a0a7c66a1576494b1905c4 Mon Sep 17 00:00:00 2001 From: Sebastian Harl Date: Fri, 20 Mar 2009 22:10:18 +0100 Subject: [PATCH] mysql plugin: Log an info message after connecting to a server. Also, improved the error message logged if the connection failed. --- src/mysql.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/mysql.c b/src/mysql.c index 565a88e0..0d3cb7f8 100644 --- a/src/mysql.c +++ b/src/mysql.c @@ -385,12 +385,22 @@ static MYSQL *getconnection (mysql_database_t *db) if (mysql_real_connect (db->con, db->host, db->user, db->pass, db->database, db->port, db->socket, 0) == NULL) { - ERROR ("mysql_real_connect failed: %s", mysql_error (db->con)); + ERROR ("mysql plugin: Failed to connect to database %s " + "at server %s: %s", + (db->database != NULL) ? db->database : "", + (db->host != NULL) ? db->host : "localhost", + mysql_error (db->con)); db->state = 0; return (NULL); } else { + INFO ("mysql plugin: Sucessfully connected to database %s " + "at server %s (server version: %s, protocol version: %d)", + (db->database != NULL) ? db->database : "", + mysql_get_host_info (db->con), + mysql_get_server_info (db->con), + mysql_get_proto_info (db->con)); db->state = 1; return (db->con); } -- 2.30.2