Added synchronous log flushing to disk when a signal is received.
This commit is contained in:
parent
fe7eac0a17
commit
49534f75b5
@ -3123,6 +3123,7 @@ void flushall_logfiles(bool flush)
|
||||
*/
|
||||
void skygw_log_sync_all(void)
|
||||
{
|
||||
skygw_log_write(LOGFILE_TRACE,"Starting log flushing to disk.");
|
||||
flushall_logfiles(true);
|
||||
skygw_message_send(lm->lm_logmes);
|
||||
skygw_message_wait(lm->lm_clientmes);
|
||||
|
@ -216,6 +216,7 @@ static void sigterm_handler (int i) {
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"MaxScale received signal SIGTERM. Exiting.")));
|
||||
skygw_log_sync_all();
|
||||
shutdown_server();
|
||||
}
|
||||
|
||||
@ -227,6 +228,7 @@ sigint_handler (int i)
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"MaxScale received signal SIGINT. Shutting down.")));
|
||||
skygw_log_sync_all();
|
||||
shutdown_server();
|
||||
fprintf(stderr, "\n\nShutting down MaxScale\n\n");
|
||||
}
|
||||
@ -269,6 +271,8 @@ sigfatal_handler (int i)
|
||||
}
|
||||
}
|
||||
|
||||
skygw_log_sync_all();
|
||||
|
||||
/* re-raise signal to enforce core dump */
|
||||
fprintf(stderr, "\n\nWriting core dump\n");
|
||||
signal_set(i, SIG_DFL);
|
||||
|
Loading…
x
Reference in New Issue
Block a user