log_manager.cc
Added new argument '-s' which takes additional argument composed of list of logfile identifiers. Logfiles listed with '-s' will be written on main memory instead of disk. In practice, the log file in question will be written in /dev/shm but corresponding symlink is added to log directory. In the case of name conflicts with log files and links, a differentiating sequence number is included in hte name of the file. This, however, is done only when existing file is not writable or is of different type (symlink <> file). Added new logfile LOGFILE_DEBUG whose contents will be largerly what was included up to date in trace log. Disabled feature which spreads writes to log files to others because of bug (#338) in the way block buffers are managed. Changed log manager parameters to match with the current implementation. List of arguments: "-h - help\n" "-a <debug prefix> ............(\"skygw_debug\")\n" "-b <debug suffix> ............(\".log\")\n" "-c <trace prefix> ............(\"skygw_trace\")\n" "-d <trace suffix> ............(\".log\")\n" "-e <message prefix> ............(\"skygw_msg\")\n" "-f <message suffix> ............(\".log\")\n" "-g <error prefix> ............(\"skygw_err\")\n" "-i <error suffix> ............(\".log\")\n" "-j <log path> ............(\"/tmp\")\n" "-s <shmem log file ids> ........(no default)\n"; dcb.c dcb_add_to_zombieslist, add dcb to the front of zombies list instead of inserting to the end of it. gateway.c Renamed shutdown_gateway to shutdown_server (Bug #131) Call skygw_logmanager_init so that trace and debug logs are written to shared memory. poll.c dcb.h Removed some dead code and references to unneeded mutexes. debugcmd.c Added enable/disable log command for debug log. skygw_utils.cc skygw_file_init now takes optional symlink name as a second argument. Symlink is created to point to the file being created.
This commit is contained in:
@ -112,24 +112,23 @@ static void sighup_handler (int i)
|
||||
}
|
||||
|
||||
static void sigterm_handler (int i) {
|
||||
extern void shutdown_gateway();
|
||||
extern void shutdown_server();
|
||||
|
||||
skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error : Signal SIGTERM %i received ...Exiting!", i);
|
||||
shutdown_gateway();
|
||||
"MaxScale received signal SIGTERM. Exiting.");
|
||||
shutdown_server();
|
||||
}
|
||||
|
||||
static void
|
||||
sigint_handler (int i)
|
||||
{
|
||||
extern void shutdown_gateway();
|
||||
extern void shutdown_server();
|
||||
|
||||
skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Error : Signal SIGINT %i received ...Exiting!",
|
||||
i);
|
||||
shutdown_gateway();
|
||||
"MaxScale received signal SIGINT. Shutting down.");
|
||||
shutdown_server();
|
||||
fprintf(stderr, "\n\nShutting down MaxScale\n\n");
|
||||
}
|
||||
|
||||
@ -485,15 +484,17 @@ main(int argc, char **argv)
|
||||
if (home)
|
||||
{
|
||||
char buf[1024];
|
||||
char *argv[4];
|
||||
char *argv[6];
|
||||
|
||||
sprintf(buf, "%s/log", home);
|
||||
mkdir(buf, 0777);
|
||||
argv[0] = "MaxScale";
|
||||
argv[1] = "-g";
|
||||
argv[1] = "-j";
|
||||
argv[2] = buf;
|
||||
argv[3] = NULL;
|
||||
skygw_logmanager_init(3, argv);
|
||||
argv[3] = "-s"; /**<! store to shared memory.. */
|
||||
argv[4] = "LOGFILE_DEBUG,LOGFILE_TRACE"; /**<! ..these logs */
|
||||
argv[5] = NULL;
|
||||
skygw_logmanager_init(5, argv);
|
||||
}
|
||||
|
||||
if (cnf_file == NULL) {
|
||||
@ -614,10 +615,10 @@ main(int argc, char **argv)
|
||||
} // End of main
|
||||
|
||||
/**
|
||||
* Shutdown the gateway
|
||||
* Shutdown MaxScale server
|
||||
*/
|
||||
void
|
||||
shutdown_gateway()
|
||||
shutdown_server()
|
||||
{
|
||||
poll_shutdown();
|
||||
log_flush_shutdown();
|
||||
@ -638,6 +639,7 @@ static void log_flush_cb(
|
||||
skygw_log_flush(LOGFILE_ERROR);
|
||||
skygw_log_flush(LOGFILE_MESSAGE);
|
||||
skygw_log_flush(LOGFILE_TRACE);
|
||||
skygw_log_flush(LOGFILE_DEBUG);
|
||||
usleep(timeout_ms*1000);
|
||||
}
|
||||
skygw_log_write(LOGFILE_MESSAGE, "Finished MaxScale log flusher.");
|
||||
|
Reference in New Issue
Block a user