MXS-2005: Use log manager only after initialization
The log manager functions must not be used before it is initialized.
This commit is contained in:
@ -1859,9 +1859,6 @@ int main(int argc, char **argv)
|
|||||||
goto return_main;
|
goto return_main;
|
||||||
}
|
}
|
||||||
|
|
||||||
mxs_log_set_syslog_enabled(*syslog_enabled);
|
|
||||||
mxs_log_set_maxlog_enabled(*maxlog_enabled);
|
|
||||||
|
|
||||||
mxs_log_target_t log_target = MXS_LOG_TARGET_FS;
|
mxs_log_target_t log_target = MXS_LOG_TARGET_FS;
|
||||||
|
|
||||||
if (to_stdout)
|
if (to_stdout)
|
||||||
@ -1876,6 +1873,9 @@ int main(int argc, char **argv)
|
|||||||
rc = MAXSCALE_BADCONFIG;
|
rc = MAXSCALE_BADCONFIG;
|
||||||
goto return_main;
|
goto return_main;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mxs_log_set_syslog_enabled(*syslog_enabled);
|
||||||
|
mxs_log_set_maxlog_enabled(*maxlog_enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!config_load_global(cnf_file_path))
|
if (!config_load_global(cnf_file_path))
|
||||||
|
@ -37,6 +37,9 @@ int main(int argc, char** argv)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mxs_log_init(NULL, NULL, MXS_LOG_TARGET_STDOUT);
|
||||||
|
atexit(mxs_log_finish);
|
||||||
|
|
||||||
if (!utils_init())
|
if (!utils_init())
|
||||||
{
|
{
|
||||||
cout << "Utils library init failed." << endl;
|
cout << "Utils library init failed." << endl;
|
||||||
|
@ -379,6 +379,7 @@ int main(int argc, char **argv)
|
|||||||
result += test_add_parameter();
|
result += test_add_parameter();
|
||||||
result += test_required_parameters();
|
result += test_required_parameters();
|
||||||
result += test_disk_space_threshold();
|
result += test_disk_space_threshold();
|
||||||
|
mxs_log_finish();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -574,10 +574,10 @@ int main()
|
|||||||
|
|
||||||
srandom(time(NULL));
|
srandom(time(NULL));
|
||||||
|
|
||||||
mxs_log_set_syslog_enabled(true);
|
|
||||||
|
|
||||||
if (mxs_log_init("TEST_EVENT", ".", MXS_LOG_TARGET_DEFAULT))
|
if (mxs_log_init("TEST_EVENT", ".", MXS_LOG_TARGET_DEFAULT))
|
||||||
{
|
{
|
||||||
|
mxs_log_set_syslog_enabled(true);
|
||||||
|
|
||||||
errors += test_levels();
|
errors += test_levels();
|
||||||
errors += test_facilities();
|
errors += test_facilities();
|
||||||
errors += test_events();
|
errors += test_events();
|
||||||
|
@ -147,10 +147,13 @@ main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
int result = 0;
|
int result = 0;
|
||||||
set_libdir(MXS_STRDUP_A("../../modules/filter/qlafilter/"));
|
set_libdir(MXS_STRDUP_A("../../modules/filter/qlafilter/"));
|
||||||
|
mxs_log_init(NULL, NULL, MXS_LOG_TARGET_STDOUT);
|
||||||
|
|
||||||
result += test1();
|
result += test1();
|
||||||
result += test2();
|
result += test2();
|
||||||
result += test3();
|
result += test3();
|
||||||
|
|
||||||
|
mxs_log_finish();
|
||||||
|
|
||||||
exit(result);
|
exit(result);
|
||||||
}
|
}
|
||||||
|
@ -465,6 +465,7 @@ int main(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
|
mxs_log_init(NULL, NULL, MXS_LOG_TARGET_STDOUT);
|
||||||
mxs::MessageQueue::init();
|
mxs::MessageQueue::init();
|
||||||
|
|
||||||
rc += test_arguments();
|
rc += test_arguments();
|
||||||
@ -476,5 +477,6 @@ int main(int argc, char **argv)
|
|||||||
rc += test_domain_matching("mariadbmon", "mysqlmon", "test_domain_matching2");
|
rc += test_domain_matching("mariadbmon", "mysqlmon", "test_domain_matching2");
|
||||||
rc += test_output();
|
rc += test_output();
|
||||||
|
|
||||||
|
mxs_log_finish();
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
@ -182,6 +182,7 @@ int main(int argc, char **argv)
|
|||||||
* allocation from failing if multiple modules from different directories are
|
* allocation from failing if multiple modules from different directories are
|
||||||
* loaded in one core function call.
|
* loaded in one core function call.
|
||||||
*/
|
*/
|
||||||
|
mxs_log_init(NULL, NULL, MXS_LOG_TARGET_STDOUT);
|
||||||
set_libdir(MXS_STRDUP_A("../../modules/authenticator/NullAuthAllow/"));
|
set_libdir(MXS_STRDUP_A("../../modules/authenticator/NullAuthAllow/"));
|
||||||
load_module("NullAuthAllow", MODULE_AUTHENTICATOR);
|
load_module("NullAuthAllow", MODULE_AUTHENTICATOR);
|
||||||
set_libdir(MXS_STRDUP_A("../../modules/protocol/HTTPD/"));
|
set_libdir(MXS_STRDUP_A("../../modules/protocol/HTTPD/"));
|
||||||
@ -196,5 +197,6 @@ int main(int argc, char **argv)
|
|||||||
result++;
|
result++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mxs_log_finish();
|
||||||
exit(result);
|
exit(result);
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,6 @@ test1()
|
|||||||
int result;
|
int result;
|
||||||
int argc = 3;
|
int argc = 3;
|
||||||
|
|
||||||
mxs_log_init(NULL, "/tmp", MXS_LOG_TARGET_FS);
|
|
||||||
init_test_env(NULL);
|
init_test_env(NULL);
|
||||||
|
|
||||||
set_libdir(MXS_STRDUP_A("../../modules/authenticator/MySQLAuth/"));
|
set_libdir(MXS_STRDUP_A("../../modules/authenticator/MySQLAuth/"));
|
||||||
|
@ -40,6 +40,7 @@ void init_test_env(char *path)
|
|||||||
{
|
{
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
atexit(mxs_log_finish);
|
||||||
dcb_global_init();
|
dcb_global_init();
|
||||||
set_libdir(MXS_STRDUP(TEST_DIR "/query_classifier/qc_sqlite/"));
|
set_libdir(MXS_STRDUP(TEST_DIR "/query_classifier/qc_sqlite/"));
|
||||||
qc_setup(NULL, QC_SQL_MODE_DEFAULT, NULL, NULL);
|
qc_setup(NULL, QC_SQL_MODE_DEFAULT, NULL, NULL);
|
||||||
|
@ -1014,6 +1014,8 @@ int main(int argc, char* argv[])
|
|||||||
{
|
{
|
||||||
cerr << "error: Could not setup query classifier." << endl;
|
cerr << "error: Could not setup query classifier." << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mxs_log_finish();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -305,6 +305,7 @@ int main()
|
|||||||
{
|
{
|
||||||
rc = (MaskingRulesTester::test_account_handling() == EXIT_FAILURE) ? EXIT_FAILURE : EXIT_SUCCESS;
|
rc = (MaskingRulesTester::test_account_handling() == EXIT_FAILURE) ? EXIT_FAILURE : EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
mxs_log_finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
|
@ -169,6 +169,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
// We ignore potential errors.
|
// We ignore potential errors.
|
||||||
mxs_log_init(NULL, NULL, MXS_LOG_TARGET_DEFAULT);
|
mxs_log_init(NULL, NULL, MXS_LOG_TARGET_DEFAULT);
|
||||||
|
atexit(mxs_log_finish);
|
||||||
mxs_log_set_augmentation(0);
|
mxs_log_set_augmentation(0);
|
||||||
mxs_log_set_priority_enabled(LOG_DEBUG, debug_out);
|
mxs_log_set_priority_enabled(LOG_DEBUG, debug_out);
|
||||||
|
|
||||||
|
@ -96,6 +96,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
|
|
||||||
mxs_log_init(NULL, NULL, MXS_LOG_TARGET_DEFAULT);
|
mxs_log_init(NULL, NULL, MXS_LOG_TARGET_DEFAULT);
|
||||||
|
atexit(mxs_log_finish);
|
||||||
|
|
||||||
mxs_log_set_priority_enabled(LOG_NOTICE, false);
|
mxs_log_set_priority_enabled(LOG_NOTICE, false);
|
||||||
mxs_log_set_priority_enabled(LOG_ERR, true);
|
mxs_log_set_priority_enabled(LOG_ERR, true);
|
||||||
|
Reference in New Issue
Block a user