summaryrefslogtreecommitdiffstats
path: root/syslogd.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2005-08-04 15:35:27 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2005-08-04 15:35:27 +0000
commitb6c5d998a8dcac443cfa80d756e6dfc0c367d64a (patch)
tree90cd7a2fa130d693cdeaf21db871817fa64f7b37 /syslogd.c
parent4568079aab0fa718b3cd0f7b0e23467de40ac3ca (diff)
downloadrsyslog-b6c5d998a8dcac443cfa80d756e6dfc0c367d64a.tar.gz
rsyslog-b6c5d998a8dcac443cfa80d756e6dfc0c367d64a.tar.xz
rsyslog-b6c5d998a8dcac443cfa80d756e6dfc0c367d64a.zip
mysql connect error messages enhanced (now go to the log themselves)
Diffstat (limited to 'syslogd.c')
-rw-r--r--syslogd.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/syslogd.c b/syslogd.c
index 3c16ce16..da9361e6 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -2416,7 +2416,7 @@ int main(argc, argv)
* release. Value 1 might be used if you would like to keep debug
* mode enabled during testing.
*/
- debugging_on = 0;
+ debugging_on = 1;
}
/*
* Send a signal to the parent to it can terminate.
@@ -5480,6 +5480,7 @@ void writeMySQL(register struct filed *f)
*/
void DBErrorHandler(register struct filed *f)
{
+ char errMsg[512];
/* TODO:
* NO DB connection -> Can not log to DB
* --------------------
@@ -5503,8 +5504,11 @@ void DBErrorHandler(register struct filed *f)
*
* Think about diffrent "delay" for diffrent errors!
*/
- dprintf("db error no: %d\n", mysql_errno(&f->f_hmysql));
- dprintf("db error: %s\n", mysql_error(&f->f_hmysql));
+ errno = 0;
+ snprintf(errMsg, sizeof(errMsg)/sizeof(char),
+ "db error (%d): %s\n", mysql_errno(&f->f_hmysql),
+ mysql_error(&f->f_hmysql));
+ logerror(errMsg);
/* Enable "delay" */
f->f_timeResumeOnError = time(&f->f_timeResumeOnError) + _DB_DELAYTIMEONERROR ;
f->f_iLastDBErrNo = mysql_errno(&f->f_hmysql);