Log: skygw_log_flush replaced with mxs_log_flush.

skygw_log_flush replaced with mxs_log_flush and skygw_log_sync_all
with mxs_log_flush_sync.
This commit is contained in:
Johan Wikman
2015-11-12 11:10:26 +02:00
parent c7a329e43e
commit 05fbdb1b76
16 changed files with 111 additions and 115 deletions

View File

@ -980,7 +980,7 @@ int dcb_read_SSL(DCB *dcb,
if (GWBUF_LENGTH(buffer) != n)
{
skygw_log_sync_all();
mxs_log_flush_sync();
}
ss_info_dassert((buffer->start <= buffer->end), "Buffer start has passed end.");

View File

@ -316,7 +316,7 @@ static void sigterm_handler (int i) {
skygw_log_write_flush(
LOGFILE_ERROR,
"MaxScale received signal SIGTERM. Exiting.");
skygw_log_sync_all();
mxs_log_flush_sync();
shutdown_server();
}
@ -328,7 +328,7 @@ sigint_handler (int i)
skygw_log_write_flush(
LOGFILE_ERROR,
"MaxScale received signal SIGINT. Shutting down.");
skygw_log_sync_all();
mxs_log_flush_sync();
shutdown_server();
fprintf(stderr, "\n\nShutting down MaxScale\n\n");
}
@ -409,7 +409,7 @@ sigfatal_handler(int i)
}
}
skygw_log_sync_all();
mxs_log_flush_sync();
/* re-raise signal to enforce core dump */
fprintf(stderr, "\n\nWriting core dump\n");
@ -822,7 +822,7 @@ static bool file_is_readable(
absolute_pathname,
eno,
strerror_r(eno, errbuf, sizeof(errbuf)));
skygw_log_sync_all();
mxs_log_flush_sync();
succp = false;
}
return succp;
@ -2054,10 +2054,7 @@ static void log_flush_cb(
LOGIF(LM, (skygw_log_write(LOGFILE_MESSAGE,
"Started MaxScale log flusher.")));
while (!do_exit) {
skygw_log_flush(LOGFILE_ERROR);
skygw_log_flush(LOGFILE_MESSAGE);
skygw_log_flush(LOGFILE_TRACE);
skygw_log_flush(LOGFILE_DEBUG);
mxs_log_flush();
nanosleep(&ts1, NULL);
}
LOGIF(LM, (skygw_log_write(LOGFILE_MESSAGE,

View File

@ -56,7 +56,7 @@ int main(int argc, char **argv)
rval = 1;
}
skygw_log_sync_all();
mxs_log_flush_sync();
mxs_log_finish();
return rval;

View File

@ -74,7 +74,7 @@ main(int argc, char **argv)
}
free(pw);
skygw_log_sync_all();
mxs_log_flush_sync();
mxs_log_finish();
return rval;
}

View File

@ -44,7 +44,7 @@
* test1 Allocate table of users and mess around with it
*
*/
void skygw_log_sync_all(void);
int mxs_log_flush_sync(void);
static int
test1()
{
@ -56,13 +56,13 @@ HINT *hint;
char* name = strdup("name");
hint = hint_create_parameter(NULL, name, "value");
free(name);
skygw_log_sync_all();
mxs_log_flush_sync();
ss_info_dassert(NULL != hint, "New hint list should not be null");
ss_info_dassert(0 == strcmp("value", hint->value), "Hint value should be correct");
ss_info_dassert(0 != hint_exists(&hint, HINT_PARAMETER), "Hint of parameter type should exist");
ss_dfprintf(stderr, "\t..done\nFree hints.");
if (NULL != hint) hint_free(hint);
skygw_log_sync_all();
mxs_log_flush_sync();
ss_dfprintf(stderr, "\t..done\n");
return 0;

View File

@ -55,7 +55,7 @@ char *status;
ss_dfprintf(stderr,
"testserver : creating server called MyServer");
server = server_alloc("MyServer", "HTTPD", 9876);
skygw_log_sync_all();
mxs_log_flush_sync();
//ss_info_dassert(NULL != service, "New server with valid protocol and port must not be null");
//ss_info_dassert(0 != service_isvalid(service), "Service must be valid after creation");
@ -63,32 +63,32 @@ char *status;
ss_dfprintf(stderr, "\t..done\nTest Parameter for Server.");
ss_info_dassert(NULL == serverGetParameter(server, "name"), "Parameter should be null when not set");
serverAddParameter(server, "name", "value");
skygw_log_sync_all();
mxs_log_flush_sync();
ss_info_dassert(0 == strcmp("value", serverGetParameter(server, "name")), "Parameter should be returned correctly");
ss_dfprintf(stderr, "\t..done\nTesting Unique Name for Server.");
ss_info_dassert(NULL == server_find_by_unique_name("uniquename"), "Should not find non-existent unique name.");
server_set_unique_name(server, "uniquename");
skygw_log_sync_all();
mxs_log_flush_sync();
ss_info_dassert(server == server_find_by_unique_name("uniquename"), "Should find by unique name.");
ss_dfprintf(stderr, "\t..done\nTesting Status Setting for Server.");
status = server_status(server);
skygw_log_sync_all();
mxs_log_flush_sync();
ss_info_dassert(0 == strcmp("Running", status), "Status of Server should be Running by default.");
if (NULL != status) free(status);
server_set_status(server, SERVER_MASTER);
status = server_status(server);
skygw_log_sync_all();
mxs_log_flush_sync();
ss_info_dassert(0 == strcmp("Master, Running", status), "Should find correct status.");
server_clear_status(server, SERVER_MASTER);
free(status);
status = server_status(server);
skygw_log_sync_all();
mxs_log_flush_sync();
ss_info_dassert(0 == strcmp("Running", status), "Status of Server should be Running after master status cleared.");
if (NULL != status) free(status);
ss_dfprintf(stderr, "\t..done\nRun Prints for Server and all Servers.");
printServer(server);
printAllServers();
skygw_log_sync_all();
mxs_log_flush_sync();
ss_dfprintf(stderr, "\t..done\nFreeing Server.");
ss_info_dassert(0 != server_free(server), "Free should succeed");
ss_dfprintf(stderr, "\t..done\n");

View File

@ -60,12 +60,12 @@ init_test_env(NULL);
ss_dfprintf(stderr,
"testservice : creating service called MyService with router nonexistent");
service = service_alloc("MyService", "non-existent");
skygw_log_sync_all();
mxs_log_flush_sync();
ss_info_dassert(NULL == service, "New service with invalid router should be null");
ss_info_dassert(0 == service_isvalid(service), "Service must not be valid after incorrect creation");
ss_dfprintf(stderr, "\t..done\nValid service creation, router testroute.");
service = service_alloc("MyService", "testroute");
skygw_log_sync_all();
mxs_log_flush_sync();
ss_info_dassert(NULL != service, "New service with valid router must not be null");
ss_info_dassert(0 != service_isvalid(service), "Service must be valid after creation");
ss_info_dassert(0 == strcmp("MyService", service_get_name(service)), "Service must have given name");
@ -73,26 +73,26 @@ init_test_env(NULL);
ss_info_dassert(0 != serviceAddProtocol(service, "testprotocol", "localhost", 9876), "Add Protocol should succeed");
ss_info_dassert(0 != serviceHasProtocol(service, "testprotocol", 9876), "Service should have new protocol as requested");
serviceStartProtocol(service, "testprotocol", 9876);
skygw_log_sync_all();
mxs_log_flush_sync();
ss_dfprintf(stderr, "\t..done\nStarting Service.");
result = serviceStart(service);
skygw_log_sync_all();
mxs_log_flush_sync();
ss_info_dassert(0 != result, "Start should succeed");
serviceStop(service);
skygw_log_sync_all();
mxs_log_flush_sync();
ss_info_dassert(service->state == SERVICE_STATE_STOPPED, "Stop should succeed");
result = serviceStartAll();
skygw_log_sync_all();
mxs_log_flush_sync();
ss_info_dassert(0 != result, "Start all should succeed");
ss_dfprintf(stderr, "\t..done\nTiming out a session.");
service->conn_timeout = 1;
result = serviceStart(service);
skygw_log_sync_all();
mxs_log_flush_sync();
ss_info_dassert(0 != result, "Start should succeed");
serviceStop(service);
skygw_log_sync_all();
mxs_log_flush_sync();
ss_info_dassert(service->state == SERVICE_STATE_STOPPED, "Stop should succeed");
if((dcb = dcb_alloc(DCB_ROLE_REQUEST_HANDLER)) == NULL)

View File

@ -58,39 +58,39 @@ int result, count;
ss_dfprintf(stderr,
"testusers : Initialise the user table.");
users = users_alloc();
skygw_log_sync_all();
mxs_log_flush_sync();
ss_info_dassert(NULL != users, "Allocating user table should not return NULL.")
ss_dfprintf(stderr, "\t..done\nAdd a user");
count = users_add(users, "username", "authorisation");
skygw_log_sync_all();
mxs_log_flush_sync();
ss_info_dassert(1 == count, "Should add one user");
authdata = users_fetch(users, "username");
skygw_log_sync_all();
mxs_log_flush_sync();
ss_info_dassert(NULL != authdata, "Fetch valid user must not return NULL");
ss_info_dassert(0 == strcmp("authorisation", authdata), "User authorisation should be correct");
ss_dfprintf(stderr, "\t..done\nPrint users");
usersPrint(users);
skygw_log_sync_all();
mxs_log_flush_sync();
ss_dfprintf(stderr, "\t..done\nUpdate a user");
count = users_update(users, "username", "newauth");
skygw_log_sync_all();
mxs_log_flush_sync();
ss_info_dassert(1 == count, "Should update just one user");
authdata = users_fetch(users, "username");
skygw_log_sync_all();
mxs_log_flush_sync();
ss_info_dassert(NULL != authdata, "Fetch valid user must not return NULL");
ss_info_dassert(0 == strcmp("newauth", authdata), "User authorisation should be correctly updated");
ss_dfprintf(stderr, "\t..done\nAdd another user");
count = users_add(users, "username2", "authorisation2");
skygw_log_sync_all();
mxs_log_flush_sync();
ss_info_dassert(1 == count, "Should add one user");
ss_dfprintf(stderr, "\t..done\nDelete a user.");
count = users_delete(users, "username");
skygw_log_sync_all();
mxs_log_flush_sync();
ss_info_dassert(1 == count, "Should delete just one user");
ss_dfprintf(stderr, "\t..done\nFree user table.");
users_free(users);
skygw_log_sync_all();
mxs_log_flush_sync();
ss_dfprintf(stderr, "\t..done\n");
return 0;