If log manager not inited messages are written to stdout.
If the log manager has not been inited, then messages are written to stdout. In practice this can happen if something is directly or indirectly logged during the startup of maxscale, before skygw_logmanager_init() has been called. Some refactoring is needed to allow skygw_logmanager_init() to be called very early at program startup.
This commit is contained in:
parent
49866b5959
commit
abea233a2e
@ -305,11 +305,6 @@ static int find_last_seqno(strpart_t* parts, int seqno, int seqnoidx);
|
||||
void flushall_logfiles(bool flush);
|
||||
bool thr_flushall_check();
|
||||
|
||||
const char* get_logpath_default(void)
|
||||
{
|
||||
return "/var/log/maxscale";
|
||||
}
|
||||
|
||||
static bool logmanager_init_nomutex(const char* logdir, int argc, char* argv[])
|
||||
{
|
||||
fnames_conf_t* fn;
|
||||
@ -1622,8 +1617,10 @@ static bool logmanager_register(bool writep)
|
||||
|
||||
if (lm == NULL)
|
||||
{
|
||||
// TODO: This looks fishy.
|
||||
succp = logmanager_init_nomutex(get_logpath_default(), 0, NULL);
|
||||
// If someone is logging before the log manager has been inited,
|
||||
// or after the log manager has been finished, the messages are
|
||||
// written to stdout.
|
||||
succp = logmanager_init_nomutex(NULL, 0, NULL);
|
||||
}
|
||||
}
|
||||
/** if logmanager existed or was succesfully restarted, increase link */
|
||||
@ -1747,7 +1744,7 @@ static bool fnames_conf_init(fnames_conf_t* fn,
|
||||
{
|
||||
use_stdout = 1;
|
||||
// TODO: Re-arrange things so that fn->fn_logpath can be NULL.
|
||||
fn->fn_logpath = strdup(get_logpath_default());
|
||||
fn->fn_logpath = strdup("/tmp"); // Not used.
|
||||
}
|
||||
|
||||
/** Set identity string for syslog if it is not set in config.*/
|
||||
|
@ -183,8 +183,6 @@ int skygw_log_get_augmentation();
|
||||
|
||||
EXTERN_C_BLOCK_END
|
||||
|
||||
const char* get_logpath_default(void);
|
||||
|
||||
/**
|
||||
* Helper, not to be called directly.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user