diff --git a/README b/README index 0fbd648e8..26a5b4ab6 100644 --- a/README +++ b/README @@ -73,8 +73,6 @@ MAXSCALE_HOME can be overriden by use of the -c flag on the command line. This should be immediately followed by the path to the MaxScale home directory. -The -f flag can be used to set the name of the configuration file -to read in place of the one in the MaxScale home directory. Merely -pass the name of the file to read followinf the -f flag. - +The -f flag can be used to set the name and the location of the configuration +file. Without path expression the file is read from $MAXSCALE_HOME/etc directory. */ diff --git a/log_manager/log_manager.cc b/log_manager/log_manager.cc index bdb43d187..3cc1d0aca 100644 --- a/log_manager/log_manager.cc +++ b/log_manager/log_manager.cc @@ -43,6 +43,12 @@ extern char *program_invocation_name; extern char *program_invocation_short_name; +/** + * Variable holding the enabled logfiles information. + * Used from log users to check enabled logs prior calling + * actual library calls such as skygw_log_write. + */ +int lm_enabled_logfiles_bitmask = 0; /** * BUFSIZ comes from the system. It equals with block size or @@ -340,6 +346,11 @@ static bool logmanager_init_nomutex( fw = &lm->lm_filewriter; fn->fn_state = UNINIT; fw->fwr_state = UNINIT; + + /** + * Set global variable + */ + lm_enabled_logfiles_bitmask = lm->lm_enabled_logfiles; /** Initialize configuration including log file naming info */ if (!fnames_conf_init(fn, argc, argv)) { @@ -1016,6 +1027,10 @@ int skygw_log_enable( if (logfile_set_enabled(id, true)) { lm->lm_enabled_logfiles |= id; + /** + * Set global variable + */ + lm_enabled_logfiles_bitmask = lm->lm_enabled_logfiles; } logmanager_unregister(); @@ -1038,6 +1053,10 @@ int skygw_log_disable( if (logfile_set_enabled(id, false)) { lm->lm_enabled_logfiles &= ~id; + /** + * Set global variable + */ + lm_enabled_logfiles_bitmask = lm->lm_enabled_logfiles; } logmanager_unregister(); diff --git a/server/core/gateway.c b/server/core/gateway.c index a0c19abda..ec97ee4b2 100644 --- a/server/core/gateway.c +++ b/server/core/gateway.c @@ -66,6 +66,13 @@ extern char *program_invocation_name; extern char *program_invocation_short_name; +/** + * Variable holding the enabled logfiles information. + * Used from log users to check enabled logs prior calling + * actual library calls such as skygw_log_write. + */ +extern int lm_enabled_logfiles_bitmask; + /* * Server options are passed to the mysql_server_init. Each gateway must have a unique * data directory that is passed to the mysql_server_init, therefore the data directory @@ -345,6 +352,7 @@ static bool resolve_maxscale_conf_fname( if (cnf_file_arg != NULL) { + char* home_etc_dir; /** * 1. argument is valid full pathname * '- /home/jdoe/MaxScale/myconf.cnf' @@ -360,9 +368,15 @@ static bool resolve_maxscale_conf_fname( * directory. * '-f MaxScale.cnf' */ + home_etc_dir = (char*)malloc(strlen(home_dir)+strlen("/etc")+1); + snprintf(home_etc_dir, + strlen(home_dir)+strlen("/etc")+1, + "%s/etc", + home_dir); *cnf_full_path = get_expanded_pathname(NULL, - home_dir, + home_etc_dir, cnf_file_arg); + free(home_etc_dir); if (*cnf_full_path != NULL) { @@ -1215,7 +1229,6 @@ int main(int argc, char **argv) "Configuration file : %s", cnf_file_path); - /* Update the server options */ for (i = 0; server_options[i]; i++) {