Syslog ident must be provided explicitly.
The syslog ident must be provided explicitly when calling skygw_logmanager_init (and not provided via the argv array). It can be NULL, in which case it automatically will be the program name. The openlog() call is now always made, irrespective of what the value of the global syslog flag is. That way it will be possible to turn syslog logging on or off after the fact.
This commit is contained in:
@ -122,7 +122,7 @@ int main(int argc, char* argv[])
|
||||
fprintf(stderr, "Couldn't register exit function.\n");
|
||||
}
|
||||
|
||||
succp = skygw_logmanager_init("/tmp", LOG_TARGET_FS, log_argc, log_argv);
|
||||
succp = skygw_logmanager_init(NULL, "/tmp", LOG_TARGET_FS, log_argc, log_argv);
|
||||
|
||||
if (!succp)
|
||||
{
|
||||
@ -141,7 +141,7 @@ int main(int argc, char* argv[])
|
||||
tm.tm_min,
|
||||
tm.tm_sec);
|
||||
|
||||
skygw_logmanager_init("/tmp", LOG_TARGET_FS, log_argc, log_argv);
|
||||
skygw_logmanager_init(NULL, "/tmp", LOG_TARGET_FS, log_argc, log_argv);
|
||||
logstr = ("First write with flush.");
|
||||
err = skygw_log_write_flush(LOGFILE_ERROR, logstr);
|
||||
|
||||
@ -189,7 +189,7 @@ int main(int argc, char* argv[])
|
||||
logstr = "Ph%dlip.";
|
||||
err = skygw_log_write(LOGFILE_TRACE, logstr, 1);
|
||||
|
||||
skygw_logmanager_init("/tmp", LOG_TARGET_FS, log_argc, log_argv);
|
||||
skygw_logmanager_init(NULL, "/tmp", LOG_TARGET_FS, log_argc, log_argv);
|
||||
logstr = ("A terrible error has occurred!");
|
||||
err = skygw_log_write_flush(LOGFILE_ERROR, logstr);
|
||||
|
||||
@ -335,7 +335,7 @@ int main(int argc, char* argv[])
|
||||
#if !defined(SS_DEBUG)
|
||||
skygw_log_enable(LOGFILE_TRACE);
|
||||
#endif
|
||||
succp = skygw_logmanager_init("/tmp", LOG_TARGET_FS, log_argc, log_argv);
|
||||
succp = skygw_logmanager_init(NULL, "/tmp", LOG_TARGET_FS, log_argc, log_argv);
|
||||
ss_dassert(succp);
|
||||
|
||||
logstr = ("\tTEST 3 - test enabling and disabling logs.");
|
||||
@ -400,7 +400,7 @@ int main(int argc, char* argv[])
|
||||
#endif /* TEST 3 */
|
||||
|
||||
#if defined(TEST4)
|
||||
succp = skygw_logmanager_init("/tmp", LOG_TARGET_FS, log_argc, log_argv);
|
||||
succp = skygw_logmanager_init(NULL, "/tmp", LOG_TARGET_FS, log_argc, log_argv);
|
||||
ss_dassert(succp);
|
||||
#if !defined(SS_DEBUG)
|
||||
skygw_log_enable(LOGFILE_TRACE);
|
||||
@ -436,7 +436,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
skygw_logmanager_done();
|
||||
|
||||
succp = skygw_logmanager_init("/tmp", LOG_TARGET_FS, log_argc, log_argv);
|
||||
succp = skygw_logmanager_init(NULL, "/tmp", LOG_TARGET_FS, log_argc, log_argv);
|
||||
ss_dassert(succp);
|
||||
#if !defined(SS_DEBUG)
|
||||
skygw_log_enable(LOGFILE_TRACE);
|
||||
@ -509,7 +509,7 @@ static void* thr_run(void* data)
|
||||
char* logstr;
|
||||
int err;
|
||||
|
||||
skygw_logmanager_init("/tmp", LOG_TARGET_FS, 0, NULL);
|
||||
skygw_logmanager_init(NULL, "/tmp", LOG_TARGET_FS, 0, NULL);
|
||||
skygw_log_flush(LOGFILE_MESSAGE);
|
||||
logstr = ("Hi, how are you?");
|
||||
err = skygw_log_write(LOGFILE_MESSAGE, logstr);
|
||||
@ -533,7 +533,7 @@ static void* thr_run(void* data)
|
||||
}
|
||||
ss_dassert(err == 0);
|
||||
err = skygw_log_write(LOGFILE_MESSAGE, logstr);
|
||||
skygw_logmanager_init("/tmp", LOG_TARGET_FS, 0, NULL);
|
||||
skygw_logmanager_init(NULL, "/tmp", LOG_TARGET_FS, 0, NULL);
|
||||
logstr = ("Testing. One, two, three\n");
|
||||
err = skygw_log_write(LOGFILE_ERROR, logstr);
|
||||
if (err != 0)
|
||||
@ -541,8 +541,8 @@ static void* thr_run(void* data)
|
||||
TEST_ERROR("Error, log write failed.");
|
||||
}
|
||||
ss_dassert(err == 0);
|
||||
skygw_logmanager_init("/tmp", LOG_TARGET_FS, 0, NULL);
|
||||
skygw_logmanager_init("/tmp", LOG_TARGET_FS, 0, NULL);
|
||||
skygw_logmanager_init(NULL, "/tmp", LOG_TARGET_FS, 0, NULL);
|
||||
skygw_logmanager_init(NULL, "/tmp", LOG_TARGET_FS, 0, NULL);
|
||||
skygw_log_flush(LOGFILE_ERROR);
|
||||
logstr = ("For automatic and register variables, it is done each time the function or block is entered.");
|
||||
|
||||
@ -556,7 +556,7 @@ static void* thr_run(void* data)
|
||||
}
|
||||
ss_dassert(err == 0);
|
||||
skygw_logmanager_done();
|
||||
skygw_logmanager_init("/tmp", LOG_TARGET_FS, 0, NULL);
|
||||
skygw_logmanager_init(NULL, "/tmp", LOG_TARGET_FS, 0, NULL);
|
||||
logstr = ("Rather more surprising, at least at first sight, is the fact that a reference "
|
||||
"to a[i] can also be written as *(a+i). In evaluating a[i], C converts it to *(a+i) "
|
||||
"immediately; the two forms are equivalent. Applying the operatos & to both parts "
|
||||
@ -568,11 +568,11 @@ static void* thr_run(void* data)
|
||||
TEST_ERROR("Error, log write failed.");
|
||||
}
|
||||
ss_dassert(err == 0);
|
||||
skygw_logmanager_init("/tmp", LOG_TARGET_FS, 0, NULL);
|
||||
skygw_logmanager_init(NULL, "/tmp", LOG_TARGET_FS, 0, NULL);
|
||||
skygw_logmanager_done();
|
||||
skygw_log_flush(LOGFILE_ERROR);
|
||||
skygw_logmanager_done();
|
||||
skygw_logmanager_init("/tmp", LOG_TARGET_FS, 0, NULL);
|
||||
skygw_logmanager_init(NULL, "/tmp", LOG_TARGET_FS, 0, NULL);
|
||||
logstr = ("..and you?");
|
||||
err = skygw_log_write(LOGFILE_MESSAGE, logstr);
|
||||
if (err != 0)
|
||||
@ -581,7 +581,7 @@ static void* thr_run(void* data)
|
||||
}
|
||||
ss_dassert(err == 0);
|
||||
skygw_logmanager_done();
|
||||
skygw_logmanager_init("/tmp", LOG_TARGET_FS, 0, NULL);
|
||||
skygw_logmanager_init(NULL, "/tmp", LOG_TARGET_FS, 0, NULL);
|
||||
logstr = ("For automatic and register variables, it is done each time the function or block is entered.");
|
||||
#if !defined(SS_DEBUG)
|
||||
skygw_log_enable(LOGFILE_TRACE);
|
||||
@ -592,7 +592,7 @@ static void* thr_run(void* data)
|
||||
TEST_ERROR("Error, log write failed.");
|
||||
}
|
||||
ss_dassert(err == 0);
|
||||
skygw_logmanager_init("/tmp", LOG_TARGET_FS, 0, NULL);
|
||||
skygw_logmanager_init(NULL, "/tmp", LOG_TARGET_FS, 0, NULL);
|
||||
logstr = ("Rather more surprising, at least at first sight, is the fact that a reference to "
|
||||
"a[i] can also be written as *(a+i). In evaluating a[i], C converts it to *(a+i) "
|
||||
"immediately; the two forms are equivalent. Applying the operatos & to both parts "
|
||||
@ -604,7 +604,7 @@ static void* thr_run(void* data)
|
||||
TEST_ERROR("Error, log write failed.");
|
||||
}
|
||||
ss_dassert(err == 0);
|
||||
skygw_logmanager_init("/tmp", LOG_TARGET_FS, 0, NULL);
|
||||
skygw_logmanager_init(NULL, "/tmp", LOG_TARGET_FS, 0, NULL);
|
||||
logstr = ("..... and you too?");
|
||||
err = skygw_log_write(LOGFILE_MESSAGE, logstr);
|
||||
if (err != 0)
|
||||
@ -613,7 +613,7 @@ static void* thr_run(void* data)
|
||||
}
|
||||
ss_dassert(err == 0);
|
||||
skygw_logmanager_done();
|
||||
skygw_logmanager_init("/tmp", LOG_TARGET_FS, 0, NULL);
|
||||
skygw_logmanager_init(NULL, "/tmp", LOG_TARGET_FS, 0, NULL);
|
||||
#if !defined(SS_DEBUG)
|
||||
skygw_log_enable(LOGFILE_TRACE);
|
||||
#endif
|
||||
@ -629,7 +629,7 @@ static void* thr_run(void* data)
|
||||
}
|
||||
ss_dassert(err == 0);
|
||||
skygw_logmanager_done();
|
||||
skygw_logmanager_init("/tmp", LOG_TARGET_FS, 0, NULL);
|
||||
skygw_logmanager_init(NULL, "/tmp", LOG_TARGET_FS, 0, NULL);
|
||||
logstr = ("Testing. One, two, three, four\n");
|
||||
err = skygw_log_write(LOGFILE_ERROR, logstr);
|
||||
if (err != 0)
|
||||
@ -638,7 +638,7 @@ static void* thr_run(void* data)
|
||||
}
|
||||
ss_dassert(err == 0);
|
||||
skygw_logmanager_done();
|
||||
skygw_logmanager_init("/tmp", LOG_TARGET_FS, 0, NULL);
|
||||
skygw_logmanager_init(NULL, "/tmp", LOG_TARGET_FS, 0, NULL);
|
||||
logstr = ("Testing. One, two, three, .. where was I?\n");
|
||||
err = skygw_log_write(LOGFILE_ERROR, logstr);
|
||||
if (err != 0)
|
||||
@ -647,7 +647,7 @@ static void* thr_run(void* data)
|
||||
}
|
||||
ss_dassert(err == 0);
|
||||
skygw_logmanager_done();
|
||||
skygw_logmanager_init("/tmp", LOG_TARGET_FS, 0, NULL);
|
||||
skygw_logmanager_init(NULL, "/tmp", LOG_TARGET_FS, 0, NULL);
|
||||
skygw_logmanager_done();
|
||||
simple_mutex_lock(td->mtx, true);
|
||||
*td->nactive -= 1;
|
||||
|
||||
Reference in New Issue
Block a user