diff --git a/log_manager/test/testlog.c b/log_manager/test/testlog.c index 28c02ba01..fe3a0ce44 100644 --- a/log_manager/test/testlog.c +++ b/log_manager/test/testlog.c @@ -64,13 +64,12 @@ int main(int argc, char* argv[]) fprintf(stderr, "Couldn't register exit function.\n"); } - r = skygw_logmanager_init(NULL, argc, argv); + r = skygw_logmanager_init( argc, argv); ss_dassert(r); t = time(NULL); tm = *(localtime(&t)); - err = skygw_log_write_flush(NULL, - LOGFILE_ERROR, + err = skygw_log_write_flush(LOGFILE_ERROR, "%04d %02d/%02d %02d.%02d.%02d", tm.tm_year+1900, tm.tm_mon+1, @@ -79,57 +78,57 @@ int main(int argc, char* argv[]) tm.tm_min, tm.tm_sec); - skygw_logmanager_init(NULL, argc, argv); + skygw_logmanager_init( argc, argv); logstr = ("First write with flush."); - err = skygw_log_write_flush(NULL, LOGFILE_ERROR, logstr); + err = skygw_log_write_flush(LOGFILE_ERROR, logstr); logstr = ("Second write with flush."); - err = skygw_log_write_flush(NULL, LOGFILE_ERROR, logstr); + err = skygw_log_write_flush(LOGFILE_ERROR, logstr); logstr = ("Third write, no flush."); - err = skygw_log_write(NULL, LOGFILE_ERROR, logstr); + err = skygw_log_write(LOGFILE_ERROR, logstr); logstr = ("Fourth write, no flush. Next flush only."); - err = skygw_log_write(NULL, LOGFILE_ERROR, logstr); + err = skygw_log_write(LOGFILE_ERROR, logstr); err = skygw_log_flush(LOGFILE_ERROR); logstr = "My name is %s %d years and %d months."; - err = skygw_log_write(NULL, LOGFILE_TRACE, logstr, "TraceyTracey", 3, 7); + err = skygw_log_write(LOGFILE_TRACE, logstr, "TraceyTracey", 3, 7); skygw_log_flush(LOGFILE_TRACE); logstr = "My name is Tracey Tracey 47 years and 7 months."; - err = skygw_log_write(NULL, LOGFILE_TRACE, logstr); + err = skygw_log_write(LOGFILE_TRACE, logstr); logstr = "My name is Stacey %s"; - err = skygw_log_write_flush(NULL, LOGFILE_TRACE, logstr, " "); - skygw_logmanager_done(NULL); + err = skygw_log_write_flush(LOGFILE_TRACE, logstr, " "); + skygw_logmanager_done(); logstr = "My name is Philip"; - err = skygw_log_write(NULL, LOGFILE_TRACE, logstr); + err = skygw_log_write(LOGFILE_TRACE, logstr); logstr = "Philip."; - err = skygw_log_write(NULL, LOGFILE_TRACE, logstr); + err = skygw_log_write(LOGFILE_TRACE, logstr); logstr = "Ph%dlip."; - err = skygw_log_write(NULL, LOGFILE_TRACE, logstr, 1); + err = skygw_log_write(LOGFILE_TRACE, logstr, 1); - skygw_logmanager_init(NULL, argc, argv); + skygw_logmanager_init( argc, argv); logstr = ("A terrible error has occurred!"); - err = skygw_log_write_flush(NULL, LOGFILE_ERROR, logstr); + err = skygw_log_write_flush(LOGFILE_ERROR, logstr); logstr = ("Hi, how are you?"); - err = skygw_log_write(NULL, LOGFILE_MESSAGE, logstr); + err = skygw_log_write(LOGFILE_MESSAGE, logstr); logstr = ("I'm doing fine!"); - err = skygw_log_write(NULL, LOGFILE_MESSAGE, logstr); + err = skygw_log_write(LOGFILE_MESSAGE, logstr); 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 operators & to both parts of this equivalence, it follows that &a[i] and a+i are also identical: a+i is the address of the i-th element beyond a."); - err = skygw_log_write(NULL, LOGFILE_ERROR, logstr); + err = skygw_log_write(LOGFILE_ERROR, logstr); logstr = ("I was wondering, you know, it has been such a lovely weather whole morning and I thought that would you like to come to my place and have a little piece of cheese with us. Just me and my mom - and you, of course. Then, if you wish, we could listen to the radio and keep company for our little Steven, my mom's cat, you know."); - err = skygw_log_write(NULL, LOGFILE_MESSAGE, logstr); - skygw_logmanager_done(NULL); + err = skygw_log_write(LOGFILE_MESSAGE, logstr); + skygw_logmanager_done(); #if defined(TEST1) @@ -168,7 +167,7 @@ int main(int argc, char* argv[]) pthread_join(thr[i]->tid, NULL); } /** This is to release memory */ - skygw_logmanager_done(NULL); + skygw_logmanager_done(); simple_mutex_unlock(mtx); @@ -217,7 +216,7 @@ int main(int argc, char* argv[]) pthread_join(thr[i]->tid, NULL); } /** This is to release memory */ - skygw_logmanager_done(NULL); + skygw_logmanager_done(); simple_mutex_unlock(mtx); @@ -243,70 +242,70 @@ static void* thr_run( char* logstr; int err; - skygw_logmanager_init(NULL, 0, NULL); - skygw_logmanager_done(NULL); + skygw_logmanager_init( 0, NULL); + skygw_logmanager_done(); skygw_log_flush(LOGFILE_MESSAGE); logstr = ("Hi, how are you?"); - err = skygw_log_write(NULL, LOGFILE_MESSAGE, logstr); + err = skygw_log_write(LOGFILE_MESSAGE, logstr); ss_dassert(err == 0); - skygw_logmanager_done(NULL); + skygw_logmanager_done(); skygw_log_flush(LOGFILE_TRACE); skygw_log_flush(LOGFILE_MESSAGE); logstr = ("I was wondering, you know, it has been such a lovely weather whole morning and I thought that would you like to come to my place and have a little piece of cheese with us. Just me and my mom - and you, of course. Then, if you wish, we could listen to the radio and keep company for our little Steven, my mom's cat, you know."); ss_dassert(err == 0); - err = skygw_log_write(NULL, LOGFILE_MESSAGE, logstr); - skygw_logmanager_init(NULL, 0, NULL); + err = skygw_log_write(LOGFILE_MESSAGE, logstr); + skygw_logmanager_init( 0, NULL); logstr = ("Testing. One, two, three\n"); - err = skygw_log_write(NULL, LOGFILE_ERROR, logstr); + err = skygw_log_write(LOGFILE_ERROR, logstr); ss_dassert(err == 0); - skygw_logmanager_init(NULL, 0, NULL); - skygw_logmanager_init(NULL, 0, NULL); + skygw_logmanager_init( 0, NULL); + skygw_logmanager_init( 0, NULL); skygw_log_flush(LOGFILE_ERROR); logstr = ("For automatic and register variables, it is done each time the function or block is entered."); - err = skygw_log_write(NULL, LOGFILE_TRACE, logstr); + err = skygw_log_write(LOGFILE_TRACE, logstr); ss_dassert(err == 0); - skygw_logmanager_done(NULL); - skygw_logmanager_init(NULL, 0, NULL); + skygw_logmanager_done(); + skygw_logmanager_init( 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 of this equivalence, it follows that &a[i] and a+i are also identical: a+i is the address of the i-th element beyond a."); - err = skygw_log_write(NULL, LOGFILE_ERROR, logstr); + err = skygw_log_write(LOGFILE_ERROR, logstr); ss_dassert(err == 0); - skygw_logmanager_init(NULL, 0, NULL); - skygw_logmanager_done(NULL); + skygw_logmanager_init( 0, NULL); + skygw_logmanager_done(); skygw_log_flush(LOGFILE_ERROR); - skygw_logmanager_done(NULL); - skygw_logmanager_done(NULL); + skygw_logmanager_done(); + skygw_logmanager_done(); logstr = ("..and you?"); - err = skygw_log_write(NULL, LOGFILE_MESSAGE, logstr); + err = skygw_log_write(LOGFILE_MESSAGE, logstr); ss_dassert(err == 0); - skygw_logmanager_init(NULL, 0, NULL); - skygw_logmanager_init(NULL, 0, NULL); + skygw_logmanager_init( 0, NULL); + skygw_logmanager_init( 0, NULL); logstr = ("For automatic and register variables, it is done each time the function or block is entered."); - err = skygw_log_write(NULL, LOGFILE_TRACE, logstr); + err = skygw_log_write(LOGFILE_TRACE, logstr); ss_dassert(err == 0); - skygw_logmanager_init(NULL, 0, NULL); + skygw_logmanager_init( 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 of this equivalence, it follows that &a[i] and a+i are also identical: a+i is the address of the i-th element beyond a."); - err = skygw_log_write(NULL, LOGFILE_ERROR, logstr); + err = skygw_log_write(LOGFILE_ERROR, logstr); ss_dassert(err == 0); - skygw_logmanager_init(NULL, 0, NULL); + skygw_logmanager_init( 0, NULL); logstr = ("..... and you too?"); - err = skygw_log_write(NULL, LOGFILE_MESSAGE, logstr); + err = skygw_log_write(LOGFILE_MESSAGE, logstr); ss_dassert(err == 0); - skygw_logmanager_done(NULL); + skygw_logmanager_done(); skygw_log_flush(LOGFILE_TRACE); logstr = ("For automatic and register variables, it is done each time the function or block is entered."); - err = skygw_log_write(NULL, LOGFILE_TRACE, logstr); + err = skygw_log_write(LOGFILE_TRACE, logstr); ss_dassert(err == 0); - skygw_logmanager_done(NULL); + skygw_logmanager_done(); logstr = ("Testing. One, two, three, four\n"); - err = skygw_log_write(NULL, LOGFILE_ERROR, logstr); + err = skygw_log_write(LOGFILE_ERROR, logstr); ss_dassert(err == 0); - skygw_logmanager_init(NULL, 0, NULL); + skygw_logmanager_init( 0, NULL); logstr = ("Testing. One, two, three, .. where was I?\n"); - err = skygw_log_write(NULL, LOGFILE_ERROR, logstr); + err = skygw_log_write(LOGFILE_ERROR, logstr); ss_dassert(err == 0); - skygw_logmanager_init(NULL, 0, NULL); - skygw_logmanager_init(NULL, 0, NULL); - skygw_logmanager_done(NULL); + skygw_logmanager_init( 0, NULL); + skygw_logmanager_init( 0, NULL); + skygw_logmanager_done(); simple_mutex_lock(td->mtx, TRUE); *td->nactive -= 1; simple_mutex_unlock(td->mtx); @@ -355,8 +354,7 @@ static void* thr_run_morelog( for (i=0; iparameters, "type"); if (type == NULL) - skygw_log_write(NULL, LOGFILE_ERROR, "Object %s has no type\n", obj->object); + skygw_log_write( LOGFILE_ERROR, "Object %s has no type\n", obj->object); else if (!strcmp(type, "service")) { char *router = config_get_value(obj->parameters, "router"); @@ -183,7 +183,7 @@ CONFIG_CONTEXT *obj; serviceSetUser(obj->element, user, auth); } else - skygw_log_write(NULL, LOGFILE_ERROR, "No router define for service '%s'\n", + skygw_log_write( LOGFILE_ERROR, "No router define for service '%s'\n", obj->object); } else if (!strcmp(type, "server")) @@ -399,7 +399,7 @@ SERVER *server; { char *type = config_get_value(obj->parameters, "type"); if (type == NULL) - skygw_log_write(NULL, LOGFILE_ERROR, "Object %s has no type\n", obj->object); + skygw_log_write( LOGFILE_ERROR, "Object %s has no type\n", obj->object); else if (!strcmp(type, "service")) { char *router = config_get_value(obj->parameters, "router"); @@ -422,7 +422,7 @@ SERVER *server; } } else - skygw_log_write(NULL, LOGFILE_ERROR, "No router defined for service '%s'\n", + skygw_log_write( LOGFILE_ERROR, "No router defined for service '%s'\n", obj->object); } else if (!strcmp(type, "server")) diff --git a/server/core/dbusers.c b/server/core/dbusers.c index 67041a7a2..0067ff28e 100644 --- a/server/core/dbusers.c +++ b/server/core/dbusers.c @@ -102,19 +102,19 @@ getUsers(SERVICE *service, struct users *users) serviceGetUser(service, &service_user, &service_passwd); /** multi-thread environment requires that thread init succeeds. */ if (mysql_thread_init()) { - skygw_log_write_flush(NULL, LOGFILE_ERROR, "ERROR : mysql_thread_init failed.\n"); + skygw_log_write_flush(LOGFILE_ERROR, "ERROR : mysql_thread_init failed.\n"); return -1; } con = mysql_init(NULL); if (con == NULL) { - skygw_log_write(NULL, LOGFILE_ERROR, "mysql_init: %s\n", mysql_error(con)); + skygw_log_write( LOGFILE_ERROR, "mysql_init: %s\n", mysql_error(con)); return -1; } if (mysql_options(con, MYSQL_OPT_USE_REMOTE_CONNECTION, NULL)) { - skygw_log_write_flush(NULL, LOGFILE_ERROR, "Fatal : failed to set external connection. " + skygw_log_write_flush(LOGFILE_ERROR, "Fatal : failed to set external connection. " "It is needed for backend server connections. Exiting.\n"); return -1; } @@ -140,7 +140,6 @@ getUsers(SERVICE *service, struct users *users) if (server == NULL) { skygw_log_write( - NULL, LOGFILE_ERROR, "Unable to get user data from backend database for service " "%s. Missing server information.", @@ -150,7 +149,7 @@ getUsers(SERVICE *service, struct users *users) } if (mysql_query(con, "SELECT user, password FROM mysql.user")) { - skygw_log_write(NULL, LOGFILE_ERROR, + skygw_log_write( LOGFILE_ERROR, "Loading users for service %s encountered error: %s\n", service->name, mysql_error(con)); mysql_close(con); @@ -160,7 +159,7 @@ getUsers(SERVICE *service, struct users *users) result = mysql_store_result(con); if (result == NULL) { - skygw_log_write(NULL, LOGFILE_ERROR, + skygw_log_write( LOGFILE_ERROR, "Loading users for service %s encountered error: %s\n", service->name, mysql_error(con)); mysql_close(con); diff --git a/server/core/dcb.c b/server/core/dcb.c index e1068a69d..89f3fe901 100644 --- a/server/core/dcb.c +++ b/server/core/dcb.c @@ -126,7 +126,7 @@ dcb_free(DCB *dcb) { if (dcb->state == DCB_STATE_ZOMBIE) { - skygw_log_write(NULL, LOGFILE_ERROR, "Call to free a DCB that is already a zombie.\n"); + skygw_log_write( LOGFILE_ERROR, "Call to free a DCB that is already a zombie.\n"); return; } @@ -144,7 +144,7 @@ dcb_free(DCB *dcb) { if (ptr == dcb) { - skygw_log_write(NULL, LOGFILE_ERROR, "Attempt to add DCB to zombie queue " + skygw_log_write( LOGFILE_ERROR, "Attempt to add DCB to zombie queue " "when it is already in the queue"); break; } @@ -285,7 +285,7 @@ GWPROTOCOL *funcs; if ((funcs = (GWPROTOCOL *)load_module(protocol, MODULE_PROTOCOL)) == NULL) { dcb_final_free(dcb); - skygw_log_write(NULL, LOGFILE_ERROR, + skygw_log_write( LOGFILE_ERROR, "Failed to load protocol module for %s, feee dcb %p\n", protocol, dcb); return NULL; } @@ -295,7 +295,7 @@ GWPROTOCOL *funcs; if ((dcb->fd = dcb->func.connect(dcb, server, session)) == -1) { dcb_final_free(dcb); - skygw_log_write(NULL, LOGFILE_ERROR, "Failed to connect to server %s:%d, free dcb %p\n", + skygw_log_write( LOGFILE_ERROR, "Failed to connect to server %s:%d, free dcb %p\n", server->name, server->port, dcb); return NULL; } diff --git a/server/core/gateway.c b/server/core/gateway.c index 436e7b776..08ebd32cd 100644 --- a/server/core/gateway.c +++ b/server/core/gateway.c @@ -90,14 +90,14 @@ static char datadir[1024] = ""; */ static void sighup_handler (int i) { - skygw_log_write(NULL, LOGFILE_MESSAGE, "Refreshing configuration following SIGHUP\n"); + skygw_log_write( LOGFILE_MESSAGE, "Refreshing configuration following SIGHUP\n"); config_reload(); } static void sigterm_handler (int i) { extern void shutdown_gateway(); - skygw_log_write(NULL, LOGFILE_ERROR, "Signal SIGTERM %i received ...Exiting!\n", i); + skygw_log_write( LOGFILE_ERROR, "Signal SIGTERM %i received ...Exiting!\n", i); shutdown_gateway(); } @@ -110,7 +110,7 @@ static void signal_set (int sig, void (*handler)(int)) { sigact.sa_handler = handler; GW_NOINTR_CALL(err = sigaction(sig, &sigact, NULL)); if (err < 0) { - skygw_log_write(NULL, LOGFILE_ERROR,"sigaction() error %s\n", strerror(errno)); + skygw_log_write( LOGFILE_ERROR,"sigaction() error %s\n", strerror(errno)); exit(1); } } @@ -261,7 +261,7 @@ char ddopt[1024]; if (s==10) { skygw_log_write( - NULL, LOGFILE_ERROR, + LOGFILE_ERROR, "Fatal : missing file name. \n" "Unable to find a MaxScale configuration file, " "either install one in /etc/MaxScale.cnf, " @@ -280,7 +280,7 @@ char ddopt[1024]; if (daemon_mode == 1) { if (sigfillset(&sigset) != 0) { - skygw_log_write(NULL, + skygw_log_write( LOGFILE_ERROR, "sigfillset() error %s\n", strerror(errno)); @@ -288,21 +288,21 @@ char ddopt[1024]; } if (sigdelset(&sigset, SIGHUP) != 0) { - skygw_log_write(NULL, + skygw_log_write( LOGFILE_ERROR, "sigdelset(SIGHUP) error %s\n", strerror(errno)); } if (sigdelset(&sigset, SIGTERM) != 0) { - skygw_log_write(NULL, + skygw_log_write( LOGFILE_ERROR, "sigdelset(SIGTERM) error %s\n", strerror(errno)); } if (sigprocmask(SIG_SETMASK, &sigset, NULL) != 0) { - skygw_log_write(NULL, + skygw_log_write( LOGFILE_ERROR, "sigprocmask() error %s\n", strerror(errno)); @@ -366,12 +366,12 @@ char ddopt[1024]; argv[1] = "-g"; argv[2] = buf; argv[3] = NULL; - skygw_logmanager_init(NULL, 3, argv); + skygw_logmanager_init(3, argv); } if (cnf_file == NULL) { skygw_log_write_flush( - NULL, LOGFILE_ERROR, + LOGFILE_ERROR, "Fatal : Unable to find a MaxScale configuration file, either " "install one in /etc/MaxScale.cnf, $MAXSCALE_HOME/etc/MaxScale.cnf " "or use the -c option. Exiting.\n"); @@ -391,7 +391,6 @@ char ddopt[1024]; if (mysql_library_init(num_elements, server_options, server_groups)) { skygw_log_write_flush( - NULL, LOGFILE_ERROR, "Fatal : mysql_library_init failed, %s. This is mandatory " "component, required by router services and the MaxScale core, " @@ -406,16 +405,15 @@ char ddopt[1024]; if (!config_load(cnf_file)) { skygw_log_write_flush( - NULL, LOGFILE_ERROR, "Failed to load MaxScale configuration file %s", cnf_file); exit(1); } - skygw_log_write(NULL, + skygw_log_write( LOGFILE_MESSAGE, "SkySQL MaxScale (C) SkySQL Ab 2013"); - skygw_log_write(NULL, + skygw_log_write( LOGFILE_MESSAGE, "MaxScale is starting, PID %i", getpid()); @@ -426,8 +424,7 @@ char ddopt[1024]; * Start the services that were created above */ n_services = serviceStartAll(); - skygw_log_write_flush(NULL, - LOGFILE_MESSAGE, + skygw_log_write_flush(LOGFILE_MESSAGE, "Start modules completed"); /* @@ -445,7 +442,7 @@ char ddopt[1024]; /* Stop all the monitors */ monitorStopAll(); - skygw_log_write(NULL, + skygw_log_write( LOGFILE_MESSAGE, "MaxScale shutdown, PID %i\n", getpid()); diff --git a/server/core/load_utils.c b/server/core/load_utils.c index 9b1dbcf04..47897d00e 100644 --- a/server/core/load_utils.c +++ b/server/core/load_utils.c @@ -81,14 +81,14 @@ MODULES *mod; sprintf(fname, "%s/modules/lib%s.so", home, module); if (access(fname, F_OK) == -1) { - skygw_log_write(NULL, LOGFILE_ERROR, + skygw_log_write( LOGFILE_ERROR, "Unable to find library for module: %s\n", module); return NULL; } } if ((dlhandle = dlopen(fname, RTLD_NOW|RTLD_LOCAL)) == NULL) { - skygw_log_write(NULL, LOGFILE_ERROR, + skygw_log_write( LOGFILE_ERROR, "Unable to load library for module: %s, %s\n", module, dlerror()); return NULL; } @@ -96,7 +96,6 @@ MODULES *mod; if ((sym = dlsym(dlhandle, "version")) == NULL) { skygw_log_write_flush( - NULL, LOGFILE_ERROR, "Version interface not supported by module: %s, %s\n", module, @@ -119,7 +118,6 @@ MODULES *mod; if ((sym = dlsym(dlhandle, "GetModuleObject")) == NULL) { skygw_log_write_flush( - NULL, LOGFILE_ERROR, "Expected entry point interface missing from module: " "%s, %s\n", @@ -131,8 +129,7 @@ MODULES *mod; ep = sym; modobj = ep(); - skygw_log_write_flush(NULL, - LOGFILE_MESSAGE, + skygw_log_write_flush(LOGFILE_MESSAGE, "Loaded module %s: %s\n", module, version); diff --git a/server/core/monitor.c b/server/core/monitor.c index 36b9c294e..e717e500c 100644 --- a/server/core/monitor.c +++ b/server/core/monitor.c @@ -61,7 +61,7 @@ MONITOR *mon; mon->name = strdup(name); if ((mon->module = load_module(module, MODULE_MONITOR)) == NULL) { - skygw_log_write(NULL, LOGFILE_ERROR, "Unable to load monitor module '%s'\n", name); + skygw_log_write( LOGFILE_ERROR, "Unable to load monitor module '%s'\n", name); free(mon->name); free(mon); return NULL; diff --git a/server/core/secrets.c b/server/core/secrets.c index fb83fc54d..f05b2bfb8 100644 --- a/server/core/secrets.c +++ b/server/core/secrets.c @@ -70,31 +70,31 @@ int fd; /* open secret file */ if ((fd = open(secret_file, O_RDONLY)) < 0) { - skygw_log_write(NULL, LOGFILE_ERROR, "secrets_readKeys, failed opening secret file [%s]. Error %i, %s\n", secret_file, errno, strerror(errno)); + skygw_log_write( LOGFILE_ERROR, "secrets_readKeys, failed opening secret file [%s]. Error %i, %s\n", secret_file, errno, strerror(errno)); return NULL; } /* accessing file details */ if (fstat(fd, &secret_stats) < 0) { - skygw_log_write(NULL, LOGFILE_ERROR, "secrets_readKeys, failed accessing secret file details [%s]. Error %i, %s\n", secret_file, errno, strerror(errno)); + skygw_log_write( LOGFILE_ERROR, "secrets_readKeys, failed accessing secret file details [%s]. Error %i, %s\n", secret_file, errno, strerror(errno)); return NULL; } if (secret_stats.st_size != sizeof(MAXKEYS)) { - skygw_log_write(NULL, LOGFILE_ERROR, "Secrets file %s is incorrect size\n", secret_file); + skygw_log_write( LOGFILE_ERROR, "Secrets file %s is incorrect size\n", secret_file); return NULL; } if (secret_stats.st_mode != (S_IRUSR|S_IFREG)) { - skygw_log_write(NULL, LOGFILE_ERROR, "Ignoring secrets file, permissions must be read only fo rthe owner\n"); + skygw_log_write( LOGFILE_ERROR, "Ignoring secrets file, permissions must be read only fo rthe owner\n"); return NULL; } if ((keys = (MAXKEYS *)malloc(sizeof(MAXKEYS))) == NULL) { - skygw_log_write(NULL, LOGFILE_ERROR, + skygw_log_write( LOGFILE_ERROR, "Insufficient memory to create the keys structure.\n"); return NULL; } @@ -102,13 +102,13 @@ int fd; /* read all data from file */ if (read(fd, keys, sizeof(MAXKEYS)) != sizeof(MAXKEYS)) { - skygw_log_write(NULL, LOGFILE_ERROR, "secrets_readKeys, failed reading from secret file [%s]. Error %i, %s\n", secret_file, errno, strerror(errno)); + skygw_log_write( LOGFILE_ERROR, "secrets_readKeys, failed reading from secret file [%s]. Error %i, %s\n", secret_file, errno, strerror(errno)); return NULL; } /* Close the file */ if (close(fd) < 0) { - skygw_log_write(NULL, LOGFILE_ERROR, "secrets_readKeys, failed closing the secret file [%s]. Error %i, %s\n", secret_file, errno, strerror(errno)); + skygw_log_write( LOGFILE_ERROR, "secrets_readKeys, failed closing the secret file [%s]. Error %i, %s\n", secret_file, errno, strerror(errno)); return NULL; } @@ -132,7 +132,7 @@ MAXKEYS key; /* Open for writing | Create | Truncate the file for writing */ if ((fd = open(secret_file, O_CREAT | O_WRONLY | O_TRUNC), S_IRUSR) < 0) { - skygw_log_write(NULL, LOGFILE_ERROR, "secrets_createKeys, failed opening secret file [%s]. Error %i, %s\n", secret_file, errno, strerror(errno)); + skygw_log_write( LOGFILE_ERROR, "secrets_createKeys, failed opening secret file [%s]. Error %i, %s\n", secret_file, errno, strerror(errno)); return 1; } @@ -143,14 +143,14 @@ MAXKEYS key; /* Write data */ if (write(fd, &key, sizeof(key)) < 0) { - skygw_log_write(NULL, LOGFILE_ERROR, "secrets_createKeys, failed writing into secret file [%s]. Error %i, %s\n", secret_file, errno, strerror(errno)); + skygw_log_write( LOGFILE_ERROR, "secrets_createKeys, failed writing into secret file [%s]. Error %i, %s\n", secret_file, errno, strerror(errno)); return 1; } /* close file */ if (close(fd) < 0) { - skygw_log_write(NULL, LOGFILE_ERROR, "secrets_createKeys, failed closing the secret file [%s]. Error %i, %s\n", secret_file, errno, strerror(errno)); + skygw_log_write( LOGFILE_ERROR, "secrets_createKeys, failed closing the secret file [%s]. Error %i, %s\n", secret_file, errno, strerror(errno)); } chmod(secret_file, S_IRUSR); diff --git a/server/core/server.c b/server/core/server.c index 11302077f..2d7b3cf1f 100644 --- a/server/core/server.c +++ b/server/core/server.c @@ -302,7 +302,7 @@ server_update(SERVER *server, char *protocol, char *user, char *passwd) { if (!strcmp(server->protocol, protocol)) { - skygw_log_write(NULL, + skygw_log_write( LOGFILE_MESSAGE, "Update server protocol for server %s to protocol %s", server->name, @@ -315,7 +315,7 @@ server_update(SERVER *server, char *protocol, char *user, char *passwd) if (strcmp(server->monuser, user) == 0 || strcmp(server->monpw, passwd) == 0) { - skygw_log_write(NULL, + skygw_log_write( LOGFILE_MESSAGE, "Update server monitor credentials for server %s", server->name); diff --git a/server/core/service.c b/server/core/service.c index 530992cd4..9953acdb2 100644 --- a/server/core/service.c +++ b/server/core/service.c @@ -112,7 +112,7 @@ GWPROTOCOL *funcs; loaded = load_mysql_users(service); - skygw_log_write(NULL, LOGFILE_MESSAGE, "MySQL Users loaded: %i\n", loaded); + skygw_log_write( LOGFILE_MESSAGE, "MySQL Users loaded: %i\n", loaded); } if ((funcs = (GWPROTOCOL *)load_module(port->protocol, MODULE_PROTOCOL)) == NULL) @@ -605,12 +605,12 @@ void *router_obj; { if ((router_obj = load_module(router, MODULE_ROUTER)) == NULL) { - skygw_log_write(NULL, LOGFILE_ERROR, "Failed to update router for service %s to %s", + skygw_log_write( LOGFILE_ERROR, "Failed to update router for service %s to %s", service->name, router); } else { - skygw_log_write(NULL, LOGFILE_MESSAGE, "Update router for service %s to %s", + skygw_log_write( LOGFILE_MESSAGE, "Update router for service %s to %s", service->name, router); free(service->routerModule); service->routerModule = strdup(router); @@ -619,7 +619,7 @@ void *router_obj; } if (user && (strcmp(service->credentials.name, user) != 0 || strcmp(service->credentials.authdata, auth) != 0)) { - skygw_log_write(NULL, LOGFILE_MESSAGE, "Update credentials for service %s", service->name); + skygw_log_write( LOGFILE_MESSAGE, "Update credentials for service %s", service->name); serviceSetUser(service, user, auth); } } diff --git a/server/core/utils.c b/server/core/utils.c index 982528427..9e7b3d633 100644 --- a/server/core/utils.c +++ b/server/core/utils.c @@ -62,12 +62,12 @@ int setnonblocking(int fd) { int fl; if ((fl = fcntl(fd, F_GETFL, 0)) == -1) { - skygw_log_write(NULL, LOGFILE_ERROR, "Can't GET fcntl for %i, errno = %d, %s", fd, errno, strerror(errno)); + skygw_log_write( LOGFILE_ERROR, "Can't GET fcntl for %i, errno = %d, %s", fd, errno, strerror(errno)); return 1; } if (fcntl(fd, F_SETFL, fl | O_NONBLOCK) == -1) { - skygw_log_write(NULL, LOGFILE_ERROR, "Can't SET fcntl for %i, errno = %d, %s", fd, errno, strerror(errno)); + skygw_log_write( LOGFILE_ERROR, "Can't SET fcntl for %i, errno = %d, %s", fd, errno, strerror(errno)); return 1; } diff --git a/server/modules/monitor/galera_mon.c b/server/modules/monitor/galera_mon.c index a996a3064..f3e6cba1e 100644 --- a/server/modules/monitor/galera_mon.c +++ b/server/modules/monitor/galera_mon.c @@ -72,7 +72,7 @@ version() void ModuleInit() { - skygw_log_write(NULL, LOGFILE_MESSAGE, "Initialise the MySQL Galera Monitor module %s.\n", + skygw_log_write( LOGFILE_MESSAGE, "Initialise the MySQL Galera Monitor module %s.\n", version_str); } @@ -334,8 +334,7 @@ MONITOR_SERVERS *ptr; if (mysql_thread_init()) { - skygw_log_write_flush(NULL, - LOGFILE_ERROR, + skygw_log_write_flush(LOGFILE_ERROR, "Fatal : mysql_init_thread failed in monitor " "module. Exiting.\n"); return; diff --git a/server/modules/monitor/mysql_mon.c b/server/modules/monitor/mysql_mon.c index 313e7e5a2..4d2a154a1 100644 --- a/server/modules/monitor/mysql_mon.c +++ b/server/modules/monitor/mysql_mon.c @@ -76,7 +76,7 @@ version() void ModuleInit() { - skygw_log_write(NULL, LOGFILE_MESSAGE, "Initialise the MySQL Monitor module %s.\n", + skygw_log_write( LOGFILE_MESSAGE, "Initialise the MySQL Monitor module %s.\n", version_str); } @@ -372,8 +372,7 @@ MONITOR_SERVERS *ptr; if (mysql_thread_init()) { - skygw_log_write_flush(NULL, - LOGFILE_ERROR, + skygw_log_write_flush(LOGFILE_ERROR, "Fatal : mysql_init_thread failed in monitor " "module. Exiting.\n"); return; diff --git a/server/modules/protocol/mysql_backend.c b/server/modules/protocol/mysql_backend.c index 886592c73..e84b9c304 100644 --- a/server/modules/protocol/mysql_backend.c +++ b/server/modules/protocol/mysql_backend.c @@ -91,7 +91,7 @@ void ModuleInit() { #if defined(SS_DEBUG) - skygw_log_write(NULL, + skygw_log_write( LOGFILE_MESSAGE, strdup("Initial MySQL Backend Protcol module.")); #endif diff --git a/server/modules/routing/debugcli.c b/server/modules/routing/debugcli.c index c8fa95699..9f553b0b1 100644 --- a/server/modules/routing/debugcli.c +++ b/server/modules/routing/debugcli.c @@ -78,7 +78,7 @@ version() void ModuleInit() { - skygw_log_write(NULL, LOGFILE_MESSAGE, "Initialise debug CLI router module %s.\n", version_str); + skygw_log_write( LOGFILE_MESSAGE, "Initialise debug CLI router module %s.\n", version_str); spinlock_init(&instlock); instances = NULL; } diff --git a/server/modules/routing/readconnroute.c b/server/modules/routing/readconnroute.c index 7cf50d8f5..155ec7504 100644 --- a/server/modules/routing/readconnroute.c +++ b/server/modules/routing/readconnroute.c @@ -114,7 +114,7 @@ version() void ModuleInit() { - skygw_log_write(NULL, + skygw_log_write( LOGFILE_MESSAGE, "Initialise readconnroute router module %s.\n", version_str); spinlock_init(&instlock); diff --git a/server/modules/routing/readwritesplit/readwritesplit.c b/server/modules/routing/readwritesplit/readwritesplit.c index 296b5ab1e..b5501a791 100644 --- a/server/modules/routing/readwritesplit/readwritesplit.c +++ b/server/modules/routing/readwritesplit/readwritesplit.c @@ -88,8 +88,7 @@ version() void ModuleInit() { - skygw_log_write_flush(NULL, - LOGFILE_MESSAGE, + skygw_log_write_flush(LOGFILE_MESSAGE, "Initialize read/write split router module.\n"); spinlock_init(&instlock); instances = NULL; @@ -104,8 +103,7 @@ ModuleInit() * @return The module object */ ROUTER_OBJECT* GetModuleObject() { - skygw_log_write(NULL, - LOGFILE_TRACE, + skygw_log_write(LOGFILE_TRACE, "Returning readwritesplit router module object."); return &MyObject; } @@ -206,17 +204,17 @@ static void* newSession( int i; if ((client = (CLIENT_SESSION *)malloc(sizeof(CLIENT_SESSION))) == NULL) - { + { return NULL; } - + /** * Find a backend server to connect to. This is the extent of the * load balancing algorithm we need to implement for this simple * connection router. */ for (i = 0; inst->servers[i]; i++) - { + { if (inst->servers[i] && SERVER_IS_SLAVE(inst->servers[i]->server)) { @@ -226,8 +224,8 @@ static void* newSession( } /** - * Loop over all the servers and find any that have fewer connections than our - * candidate server. + * Loop over all the servers and find any that have fewer connections + * than our candidate server. * * If a server has less connections than the current candidate we mark this * as the new candidate to connect to. @@ -434,7 +432,7 @@ static int routeQuery( "Packet type\t%s", STRPACKETTYPE(packet_type)); #endif - + switch (qtype) { case QUERY_TYPE_WRITE: #if defined(SS_DEBUG_) diff --git a/table_replication_consistency/table_replication_consistency.cpp b/table_replication_consistency/table_replication_consistency.cpp index 2a6dc3c45..baa1a4833 100644 --- a/table_replication_consistency/table_replication_consistency.cpp +++ b/table_replication_consistency/table_replication_consistency.cpp @@ -204,7 +204,7 @@ tb_replication_consistency_init( strcpy(rpl[i].error_message, errmsg.c_str()); // This will log error to log file - skygw_log_write_flush(NULL, LOGFILE_ERROR, (char *)errmsg.c_str()); + skygw_log_write_flush( LOGFILE_ERROR, (char *)errmsg.c_str()); return (1); } @@ -273,7 +273,7 @@ error_handling: tb_consistency[i].error_message = (char *)malloc(errmsg.size()+1); strcpy(tb_consistency[i].error_message, errmsg.c_str()); // This will log error to log file - skygw_log_write_flush(NULL, LOGFILE_ERROR, (char *)errmsg.c_str()); + skygw_log_write_flush( LOGFILE_ERROR, (char *)errmsg.c_str()); err_exit: *n_servers=i-1; @@ -335,7 +335,7 @@ error_handling: rpl->error_message = (char *)malloc(errmsg.size()+1); strcpy(rpl->error_message, errmsg.c_str()); // This will log error to log file - skygw_log_write_flush(NULL, LOGFILE_ERROR, (char *)errmsg.c_str()); + skygw_log_write_flush( LOGFILE_ERROR, (char *)errmsg.c_str()); err_exit: return (1); @@ -420,7 +420,7 @@ error_handling: *error_message = (char *)malloc(errmsg.size()+1); strcpy(*error_message, errmsg.c_str()); // This will log error to log file - skygw_log_write_flush(NULL, LOGFILE_ERROR, (char *)errmsg.c_str()); + skygw_log_write_flush( LOGFILE_ERROR, (char *)errmsg.c_str()); err_exit: return (1); diff --git a/table_replication_consistency/table_replication_listener.cpp b/table_replication_consistency/table_replication_listener.cpp index cb4baf5d2..51cf75779 100644 --- a/table_replication_consistency/table_replication_listener.cpp +++ b/table_replication_consistency/table_replication_listener.cpp @@ -205,7 +205,7 @@ tbrl_update_consistency( if (tbr_trace) { // This will log error to log file - skygw_log_write_flush(NULL, LOGFILE_TRACE, + skygw_log_write_flush( LOGFILE_TRACE, (char *)"TRC Trace: Current state for table %s in server %d binlog_pos %lu GTID '%s'", tc->db_table, tc->server_id, tc->binlog_pos, gtid.get_string().c_str()); } @@ -261,7 +261,7 @@ tbrl_update_server_status( if (tbr_trace) { // This will log error to log file - skygw_log_write_flush(NULL, LOGFILE_TRACE, + skygw_log_write_flush( LOGFILE_TRACE, (char *)"TRC Trace: Current state for server %d binlog_pos %lu GTID '%s'", ts->server_id, ts->binlog_pos, gtid.get_string().c_str()); } @@ -309,7 +309,7 @@ void* tb_replication_listener_reader( if (tbr_trace) { string trace_msg = "Server " + string(uri) + string(server_type); - skygw_log_write_flush(NULL, LOGFILE_TRACE, (char *)trace_msg.c_str()); + skygw_log_write_flush( LOGFILE_TRACE, (char *)trace_msg.c_str()); } Binary_log_event *event; @@ -373,7 +373,7 @@ void* tb_replication_listener_reader( } if (tbr_debug) { - skygw_log_write_flush(NULL, LOGFILE_TRACE, + skygw_log_write_flush( LOGFILE_TRACE, (char *)"TRC Debug: Thread %ld Server %d Binlog_pos %lu event %d" " : %s Query %s DB %s gtid '%s'", id, @@ -405,7 +405,7 @@ void* tb_replication_listener_reader( } if (tbr_debug) { - skygw_log_write_flush(NULL, LOGFILE_TRACE, + skygw_log_write_flush( LOGFILE_TRACE, (char *)"TRC Debug: Thread %ld Server %d Binlog_pos %lu event %d" " : %s gtid '%s'", id, @@ -429,7 +429,7 @@ void* tb_replication_listener_reader( tid2tname[table_map_event->table_id]= database_dot_table; if (tbr_debug) { - skygw_log_write_flush(NULL, LOGFILE_TRACE, + skygw_log_write_flush( LOGFILE_TRACE, (char *)"TRC Debug: Thread %ld Server %d Binlog_pos %lu event %d" " : %s dbtable '%s' id %d", id, @@ -460,7 +460,7 @@ void* tb_replication_listener_reader( } if (tbr_debug) { - skygw_log_write_flush(NULL, LOGFILE_TRACE, + skygw_log_write_flush( LOGFILE_TRACE, (char *)"TRC Debug: Thread %ld Server %d Binlog_pos %lu event %d" " : %s dbtable '%s' id %d", id, @@ -488,14 +488,14 @@ void* tb_replication_listener_reader( catch(ListenerException e) { string err = std::string("Listener exception: ")+ e.what(); - skygw_log_write_flush(NULL, LOGFILE_ERROR, (char *)err.c_str()); + skygw_log_write_flush( LOGFILE_ERROR, (char *)err.c_str()); // Re-Throw this one. throw; } catch(boost::system::error_code e) { string err = std::string("Listener system exception: ")+ e.message(); - skygw_log_write_flush(NULL, LOGFILE_ERROR, (char *)err.c_str()); + skygw_log_write_flush( LOGFILE_ERROR, (char *)err.c_str()); // Re-Throw this one. throw; } @@ -503,7 +503,7 @@ void* tb_replication_listener_reader( catch(std::exception const& e) { string err = std::string("Listener other exception: ")+ e.what(); - skygw_log_write_flush(NULL, LOGFILE_ERROR, (char *)err.c_str()); + skygw_log_write_flush( LOGFILE_ERROR, (char *)err.c_str()); // Re-Throw this one. throw; } @@ -511,7 +511,7 @@ void* tb_replication_listener_reader( catch(...) { string err = std::string("Unknown exception: "); - skygw_log_write_flush(NULL, LOGFILE_ERROR, (char *)err.c_str()); + skygw_log_write_flush( LOGFILE_ERROR, (char *)err.c_str()); // Re-Throw this one. // It was not handled so you want to make sure it is handled correctly by // the OS. So just allow the exception to keep propagating. @@ -520,7 +520,7 @@ void* tb_replication_listener_reader( if (tbr_trace) { string trace_msg = string("Listener for server ") + string(uri) + string(server_type) + string(" shutting down"); - skygw_log_write_flush(NULL, LOGFILE_TRACE, (char *)trace_msg.c_str()); + skygw_log_write_flush( LOGFILE_TRACE, (char *)trace_msg.c_str()); } // Thread execution will end here @@ -551,7 +551,7 @@ tb_replication_listener_shutdown( Binary_log *binlog = (*b_it).second; if (tbr_debug) { - skygw_log_write_flush(NULL, LOGFILE_TRACE, + skygw_log_write_flush( LOGFILE_TRACE, (char *)"TRC Debug: Shutting down replication listener for server %s", binlog->get_url().c_str()); } @@ -562,14 +562,14 @@ tb_replication_listener_shutdown( catch(ListenerException e) { string err = std::string("Listener exception: ")+ e.what(); - skygw_log_write_flush(NULL, LOGFILE_ERROR, (char *)err.c_str()); + skygw_log_write_flush( LOGFILE_ERROR, (char *)err.c_str()); // Re-Throw this one. throw; } catch(boost::system::error_code e) { string err = std::string("Listener system exception: ")+ e.message(); - skygw_log_write_flush(NULL, LOGFILE_ERROR, (char *)err.c_str()); + skygw_log_write_flush( LOGFILE_ERROR, (char *)err.c_str()); // Re-Throw this one. throw; } @@ -577,7 +577,7 @@ tb_replication_listener_shutdown( catch(std::exception const& e) { string err = std::string("Listener other exception: ")+ e.what(); - skygw_log_write_flush(NULL, LOGFILE_ERROR, (char *)err.c_str()); + skygw_log_write_flush( LOGFILE_ERROR, (char *)err.c_str()); // Re-Throw this one. throw; } @@ -585,7 +585,7 @@ tb_replication_listener_shutdown( catch(...) { string err = std::string("Unknown exception: "); - skygw_log_write_flush(NULL, LOGFILE_ERROR, (char *)err.c_str()); + skygw_log_write_flush( LOGFILE_ERROR, (char *)err.c_str()); // Re-Throw this one. // It was not handled so you want to make sure it is handled correctly by // the OS. So just allow the exception to keep propagating. @@ -598,7 +598,7 @@ tb_replication_listener_shutdown( *error_message = (char *)malloc(err.size()+1); strcpy(*error_message, err.c_str()); - skygw_log_write_flush(NULL, LOGFILE_ERROR, (char *)err.c_str()); + skygw_log_write_flush( LOGFILE_ERROR, (char *)err.c_str()); return (1); } @@ -640,7 +640,7 @@ tb_replication_listener_consistency( if (found) { if (tbr_trace) { // This will log error to log file - skygw_log_write_flush(NULL, LOGFILE_TRACE, + skygw_log_write_flush( LOGFILE_TRACE, (char *)"TRC Trace: Current state for table %s in server %d binlog_pos %lu GTID '%s'", tc->db_table, tc->server_id, tc->binlog_pos, tc->gtid); } @@ -683,7 +683,7 @@ tb_replication_listener_reconnect( if (found) { if (tbr_debug) { - skygw_log_write_flush(NULL, LOGFILE_TRACE, + skygw_log_write_flush( LOGFILE_TRACE, (char *)"TRC Debug: Reconnecting to server %s", binlog->get_url().c_str()); } @@ -719,14 +719,14 @@ tb_replication_listener_reconnect( catch(ListenerException e) { string err = std::string("Listener exception: ")+ e.what(); - skygw_log_write_flush(NULL, LOGFILE_ERROR, (char *)err.c_str()); + skygw_log_write_flush( LOGFILE_ERROR, (char *)err.c_str()); // Re-Throw this one. throw; } catch(boost::system::error_code e) { string err = std::string("Listener system exception: ")+ e.message(); - skygw_log_write_flush(NULL, LOGFILE_ERROR, (char *)err.c_str()); + skygw_log_write_flush( LOGFILE_ERROR, (char *)err.c_str()); // Re-Throw this one. throw; } @@ -734,7 +734,7 @@ tb_replication_listener_reconnect( catch(std::exception const& e) { string err = std::string("Listener other exception: ")+ e.what(); - skygw_log_write_flush(NULL, LOGFILE_ERROR, (char *)err.c_str()); + skygw_log_write_flush( LOGFILE_ERROR, (char *)err.c_str()); // Re-Throw this one. throw; } @@ -742,7 +742,7 @@ tb_replication_listener_reconnect( catch(...) { string err = std::string("Unknown exception: "); - skygw_log_write_flush(NULL, LOGFILE_ERROR, (char *)err.c_str()); + skygw_log_write_flush( LOGFILE_ERROR, (char *)err.c_str()); // Re-Throw this one. // It was not handled so you want to make sure it is handled correctly by // the OS. So just allow the exception to keep propagating. @@ -761,7 +761,7 @@ err_exit: if (error_message) { rpl->error_message = (char *)malloc(strlen(error_message +1)); strcpy(rpl->error_message, error_message); - skygw_log_write_flush(NULL, LOGFILE_ERROR, error_message); + skygw_log_write_flush( LOGFILE_ERROR, error_message); } return (1); @@ -802,7 +802,7 @@ void tm = (tbr_metadata_t**)calloc(nelems, sizeof(tbr_metadata_t*)); if (!tm) { - skygw_log_write_flush(NULL, LOGFILE_ERROR, (char *)"Error: TRM: Out of memory"); + skygw_log_write_flush( LOGFILE_ERROR, (char *)"Error: TRM: Out of memory"); goto my_exit; } @@ -841,7 +841,7 @@ void ts = (tbr_server_t**)calloc(nelems, sizeof(tbr_server_t*)); if (!ts) { - skygw_log_write_flush(NULL, LOGFILE_ERROR, (char *)"Error: TRM: Out of memory"); + skygw_log_write_flush( LOGFILE_ERROR, (char *)"Error: TRM: Out of memory"); goto my_exit; } @@ -870,27 +870,27 @@ void catch(ListenerException e) { string err = std::string("Listener exception: ")+ e.what(); - skygw_log_write_flush(NULL, LOGFILE_ERROR, (char *)err.c_str()); + skygw_log_write_flush( LOGFILE_ERROR, (char *)err.c_str()); goto my_exit; } catch(boost::system::error_code e) { string err = std::string("Listener system exception: ")+ e.message(); - skygw_log_write_flush(NULL, LOGFILE_ERROR, (char *)err.c_str()); + skygw_log_write_flush( LOGFILE_ERROR, (char *)err.c_str()); goto my_exit; } // Try and catch all exceptions catch(std::exception const& e) { string err = std::string("Listener other exception: ")+ e.what(); - skygw_log_write_flush(NULL, LOGFILE_ERROR, (char *)err.c_str()); + skygw_log_write_flush( LOGFILE_ERROR, (char *)err.c_str()); goto my_exit; } // Rest of them catch(...) { string err = std::string("Unknown exception: "); - skygw_log_write_flush(NULL, LOGFILE_ERROR, (char *)err.c_str()); + skygw_log_write_flush( LOGFILE_ERROR, (char *)err.c_str()); goto my_exit; } } @@ -906,7 +906,7 @@ my_exit: } if (tbr_trace) { - skygw_log_write_flush(NULL, LOGFILE_TRACE, (char *)"Shutting down the metadata updater thread"); + skygw_log_write_flush( LOGFILE_TRACE, (char *)"Shutting down the metadata updater thread"); } pthread_exit(NULL); @@ -974,27 +974,27 @@ tb_replication_listener_init( catch(ListenerException e) { err = std::string("Listener exception: ")+ e.what(); - skygw_log_write_flush(NULL, LOGFILE_ERROR, (char *)err.c_str()); + skygw_log_write_flush( LOGFILE_ERROR, (char *)err.c_str()); goto error_exit; } catch(boost::system::error_code e) { err = std::string("Listener system exception: ")+ e.message(); - skygw_log_write_flush(NULL, LOGFILE_ERROR, (char *)err.c_str()); + skygw_log_write_flush( LOGFILE_ERROR, (char *)err.c_str()); goto error_exit; } // Try and catch all exceptions catch(std::exception const& e) { err = std::string("Listener other exception: ")+ e.what(); - skygw_log_write_flush(NULL, LOGFILE_ERROR, (char *)err.c_str()); + skygw_log_write_flush( LOGFILE_ERROR, (char *)err.c_str()); goto error_exit; } // Rest of them catch(...) { err = std::string("Unknown exception: "); - skygw_log_write_flush(NULL, LOGFILE_ERROR, (char *)err.c_str()); + skygw_log_write_flush( LOGFILE_ERROR, (char *)err.c_str()); goto error_exit; } @@ -1026,7 +1026,7 @@ tb_replication_listener_done( ts = (tbr_server_t **)calloc(nelems2, sizeof(tbr_server_t*)); if (tm == NULL || ts == NULL) { - skygw_log_write_flush(NULL, LOGFILE_ERROR, (char *)"TRM: Out of memory"); + skygw_log_write_flush( LOGFILE_ERROR, (char *)"TRM: Out of memory"); goto error_exit; } @@ -1094,32 +1094,32 @@ tb_replication_listener_done( catch(ListenerException e) { string err = std::string("Listener exception: ")+ e.what(); - skygw_log_write_flush(NULL, LOGFILE_ERROR, (char *)err.c_str()); + skygw_log_write_flush( LOGFILE_ERROR, (char *)err.c_str()); goto error_exit; } catch(boost::system::error_code e) { string err = std::string("Listener system exception: ")+ e.message(); - skygw_log_write_flush(NULL, LOGFILE_ERROR, (char *)err.c_str()); + skygw_log_write_flush( LOGFILE_ERROR, (char *)err.c_str()); goto error_exit; } // Try and catch all exceptions catch(std::exception const& e) { string err = std::string("Listener other exception: ")+ e.what(); - skygw_log_write_flush(NULL, LOGFILE_ERROR, (char *)err.c_str()); + skygw_log_write_flush( LOGFILE_ERROR, (char *)err.c_str()); goto error_exit; } // Rest of them catch(...) { string err = std::string("Unknown exception: "); - skygw_log_write_flush(NULL, LOGFILE_ERROR, (char *)err.c_str()); + skygw_log_write_flush( LOGFILE_ERROR, (char *)err.c_str()); goto error_exit; } if (tbr_trace) { - skygw_log_write_flush(NULL, LOGFILE_TRACE, (char *)"Shutting down the listeners"); + skygw_log_write_flush( LOGFILE_TRACE, (char *)"Shutting down the listeners"); goto error_exit; } diff --git a/table_replication_consistency/table_replication_metadata.cpp b/table_replication_consistency/table_replication_metadata.cpp index 600f61f42..76b041546 100644 --- a/table_replication_consistency/table_replication_metadata.cpp +++ b/table_replication_consistency/table_replication_metadata.cpp @@ -54,10 +54,10 @@ tbrm_report_error( const char *file, /*!< in: File name */ int line) /*!< in: Line number */ { - skygw_log_write_flush(NULL, LOGFILE_ERROR, + skygw_log_write_flush( LOGFILE_ERROR, (char *)"%s at file %s line %d", message, file, line); if (con != NULL) { - skygw_log_write_flush(NULL, LOGFILE_ERROR, + skygw_log_write_flush( LOGFILE_ERROR, (char *)"%s", mysql_error(con)); mysql_close(con); } @@ -74,12 +74,12 @@ tbrm_stmt_error( const char *file, /*!< in: File name */ int line) /*!< in: Line number */ { - skygw_log_write_flush(NULL, LOGFILE_ERROR, + skygw_log_write_flush( LOGFILE_ERROR, (char *)"%s at file %s line %d", message, file, line); if (stmt != NULL) { - skygw_log_write_flush(NULL, LOGFILE_ERROR, + skygw_log_write_flush( LOGFILE_ERROR, (char *)"Error %u (%s): %s\n", mysql_stmt_errno (stmt), mysql_stmt_sqlstate (stmt), @@ -104,7 +104,7 @@ tbrm_create_metadata( unsigned int myerrno=0; if (!con) { - skygw_log_write_flush(NULL, LOGFILE_ERROR, + skygw_log_write_flush( LOGFILE_ERROR, (char *)"Mysql init failed", mysql_error(con)); return false; } @@ -230,7 +230,7 @@ tbrm_read_consistency_metadata( MYSQL *con = mysql_init(NULL); if (!con) { - skygw_log_write_flush(NULL, LOGFILE_ERROR, + skygw_log_write_flush( LOGFILE_ERROR, (char *)"Error: MySQL init failed"); return false; } @@ -271,7 +271,7 @@ tbrm_read_consistency_metadata( tm = (tbr_metadata_t*) malloc(nrows * sizeof(tbr_metadata_t)); if (!tm) { - skygw_log_write_flush(NULL, LOGFILE_ERROR, + skygw_log_write_flush( LOGFILE_ERROR, (char *)"Error: Out of memory"); goto error_exit; } @@ -287,7 +287,7 @@ tbrm_read_consistency_metadata( tm[i].db_table = (unsigned char *)malloc(lengths[0]); if (!tm[i].db_table) { - skygw_log_write_flush(NULL, LOGFILE_ERROR, + skygw_log_write_flush( LOGFILE_ERROR, (char *)"Error: Out of memory"); goto error_exit; } @@ -300,7 +300,7 @@ tbrm_read_consistency_metadata( if (!tm[i].gtid) { free(tm[i].db_table); - skygw_log_write_flush(NULL, LOGFILE_ERROR, + skygw_log_write_flush( LOGFILE_ERROR, (char *)"Error: Out of memory"); goto error_exit; } @@ -388,7 +388,7 @@ tbrm_write_consistency_metadata( MYSQL *con = mysql_init(NULL); if (!con) { - skygw_log_write_flush(NULL, LOGFILE_ERROR, + skygw_log_write_flush( LOGFILE_ERROR, (char *)"Mysql init failed", mysql_error(con)); return false; } @@ -540,7 +540,7 @@ tbrm_write_consistency_metadata( goto error_exit; } if (tbr_debug) { - skygw_log_write_flush(NULL, LOGFILE_TRACE, + skygw_log_write_flush( LOGFILE_TRACE, (char *)"TRC Debug: Metadata state updated for %s in server %d is binlog_pos %lu gtid '%s'", dbtable, serverid, binlogpos, gtid); } @@ -562,7 +562,7 @@ tbrm_write_consistency_metadata( } if (tbr_debug) { - skygw_log_write_flush(NULL, LOGFILE_TRACE, + skygw_log_write_flush( LOGFILE_TRACE, (char *)"TRC Debug: Metadata state inserted for %s in server %d is binlog_pos %lu gtid '%s'", dbtable, serverid, binlogpos, gtid); } @@ -626,7 +626,7 @@ tbrm_read_server_metadata( MYSQL *con = mysql_init(NULL); if (!con) { - skygw_log_write_flush(NULL, LOGFILE_ERROR, + skygw_log_write_flush( LOGFILE_ERROR, (char *)"Mysql init failed", mysql_error(con)); return false; @@ -668,7 +668,7 @@ tbrm_read_server_metadata( ts = (tbr_server_t*) malloc(nrows * sizeof(tbr_server_t)); if(!ts) { - skygw_log_write_flush(NULL, LOGFILE_ERROR, + skygw_log_write_flush( LOGFILE_ERROR, (char *)"Error: Out of memory"); goto error_exit; } @@ -687,7 +687,7 @@ tbrm_read_server_metadata( ts[i].gtid = (unsigned char *)malloc((lengths[2])*sizeof(unsigned char)); if (!ts[i].gtid) { - skygw_log_write_flush(NULL, LOGFILE_ERROR, + skygw_log_write_flush( LOGFILE_ERROR, (char *)"Error: Out of memory"); goto error_exit; } @@ -774,7 +774,7 @@ tbrm_write_server_metadata( MYSQL *con = mysql_init(NULL); if (!con) { - skygw_log_write_flush(NULL, LOGFILE_ERROR, + skygw_log_write_flush( LOGFILE_ERROR, (char *)"Mysql init failed", mysql_error(con)); return false; } @@ -919,7 +919,7 @@ tbrm_write_server_metadata( goto error_exit; } if (tbr_debug) { - skygw_log_write_flush(NULL, LOGFILE_TRACE, + skygw_log_write_flush( LOGFILE_TRACE, (char *)"TRC Debug: Metadata state updated for %s in server %d is binlog_pos %lu gtid '%s'", dbtable, serverid, binlogpos, gtid); } @@ -941,7 +941,7 @@ tbrm_write_server_metadata( } if (tbr_debug) { - skygw_log_write_flush(NULL, LOGFILE_TRACE, + skygw_log_write_flush( LOGFILE_TRACE, (char *)"TRC Debug: Metadata state inserted for %s in server %d is binlog_pos %lu gtid '%s'", dbtable, serverid, binlogpos, gtid); } diff --git a/table_replication_consistency/table_replication_parser.cpp b/table_replication_consistency/table_replication_parser.cpp index f1372a56f..a14f825df 100644 --- a/table_replication_consistency/table_replication_parser.cpp +++ b/table_replication_consistency/table_replication_parser.cpp @@ -366,7 +366,7 @@ tbr_parser_table_names( name_count++; if (tbr_debug) { - skygw_log_write_flush(NULL, LOGFILE_TRACE, + skygw_log_write_flush( LOGFILE_TRACE, (char *)"TRC Debug: INSERT OR REPLACE to %s.%s", dbname, tbname); } @@ -404,7 +404,7 @@ tbr_parser_table_names( name_count++; if (tbr_debug) { - skygw_log_write_flush(NULL, LOGFILE_TRACE, + skygw_log_write_flush( LOGFILE_TRACE, (char *)"TRC Debug: DELETE OR UPDATE to %s.%s", dbname, tbname); } @@ -433,7 +433,7 @@ tbr_parser_table_names( name_count++; if (tbr_debug) { - skygw_log_write_flush(NULL, LOGFILE_TRACE, + skygw_log_write_flush( LOGFILE_TRACE, (char *)"TRC Debug: LOAD to %s.%s", dbname, tbname); } @@ -480,7 +480,7 @@ tbr_parser_table_names( name_count++; if (tbr_debug) { - skygw_log_write_flush(NULL, LOGFILE_TRACE, + skygw_log_write_flush( LOGFILE_TRACE, (char *)"TRC Debug: DROP TABLE to %s.%s", dbname, tbname); } @@ -490,7 +490,7 @@ tbr_parser_table_names( return (false); } } - skygw_log_write_flush(NULL, LOGFILE_TRACE, + skygw_log_write_flush( LOGFILE_TRACE, (char *)"TRC Debug: CREATE/DROP TABLE to %s.%s", dbname, tbname); }