Rename some log concepts
The mxs prefix is now uniformly used with all log components.
This commit is contained in:
parent
6ab9b4ca67
commit
916ee5ff2a
@ -120,19 +120,19 @@ static struct
|
||||
* Variable holding the enabled priorities information.
|
||||
* Used from logging macros.
|
||||
*/
|
||||
int lm_enabled_priorities_bitmask = 0;
|
||||
int mxs_log_enabled_priorities = 0;
|
||||
|
||||
/**
|
||||
* Thread-specific struct variable for storing current session id and currently
|
||||
* enabled log files for the session.
|
||||
*/
|
||||
__thread log_info_t tls_log_info = {0, 0};
|
||||
__thread mxs_log_info_t mxs_log_tls = {0, 0};
|
||||
|
||||
/**
|
||||
* Global counter for each log file type. It indicates for how many sessions
|
||||
* each log type is currently enabled.
|
||||
*/
|
||||
ssize_t log_ses_count[LOG_DEBUG] = {0};
|
||||
ssize_t mxs_log_session_count[LOG_DEBUG] = {0};
|
||||
|
||||
/**
|
||||
* BUFSIZ comes from the system. It equals with block size or
|
||||
@ -273,7 +273,7 @@ struct logmanager
|
||||
fnames_conf_t lm_fnames_conf;
|
||||
logfile_t lm_logfile;
|
||||
filewriter_t lm_filewriter;
|
||||
log_target_t lm_target;
|
||||
mxs_log_target_t lm_target;
|
||||
#if defined(SS_DEBUG)
|
||||
skygw_chk_t lm_chk_tail;
|
||||
#endif
|
||||
@ -300,7 +300,7 @@ static void logfile_done(logfile_t* logfile);
|
||||
static void logfile_free_memory(logfile_t* lf);
|
||||
static void logfile_flush(logfile_t* lf);
|
||||
static void logfile_rotate(logfile_t* lf);
|
||||
static bool logfile_create(logfile_t* lf);
|
||||
static bool logfile_build_name(logfile_t* lf);
|
||||
static bool logfile_open_file(filewriter_t* fw, logfile_t* lf);
|
||||
static char* form_full_file_name(strpart_t* parts, logfile_t* lf, int seqnoidx);
|
||||
|
||||
@ -316,7 +316,7 @@ static bool logmanager_register(bool writep);
|
||||
static void logmanager_unregister(void);
|
||||
static bool logmanager_init_nomutex(const char* ident,
|
||||
const char* logdir,
|
||||
log_target_t target);
|
||||
mxs_log_target_t target);
|
||||
static void logmanager_done_nomutex(void);
|
||||
|
||||
static int logmanager_write_log(int priority,
|
||||
@ -346,7 +346,7 @@ bool thr_flushall_check();
|
||||
|
||||
static bool logmanager_init_nomutex(const char* ident,
|
||||
const char* logdir,
|
||||
log_target_t target)
|
||||
mxs_log_target_t target)
|
||||
{
|
||||
fnames_conf_t* fn;
|
||||
filewriter_t* fw;
|
||||
@ -361,7 +361,7 @@ static bool logmanager_init_nomutex(const char* ident,
|
||||
goto return_succ;
|
||||
}
|
||||
|
||||
lm->lm_target = (target == LOG_TARGET_DEFAULT ? LOG_TARGET_FS : target);
|
||||
lm->lm_target = (target == MXS_LOG_TARGET_DEFAULT ? MXS_LOG_TARGET_FS : target);
|
||||
#if defined(SS_DEBUG)
|
||||
lm->lm_chk_top = CHK_NUM_LOGMANAGER;
|
||||
lm->lm_chk_tail = CHK_NUM_LOGMANAGER;
|
||||
@ -405,7 +405,7 @@ static bool logmanager_init_nomutex(const char* ident,
|
||||
/**
|
||||
* Set global variable
|
||||
*/
|
||||
lm_enabled_priorities_bitmask = MXS_LOG_ERR | MXS_LOG_NOTICE;
|
||||
mxs_log_enabled_priorities = MXS_LOG_ERR | MXS_LOG_NOTICE;
|
||||
|
||||
/**
|
||||
* Initialize filewriter data and open the log file
|
||||
@ -459,7 +459,7 @@ return_succ:
|
||||
* @return true if succeed, otherwise false
|
||||
*
|
||||
*/
|
||||
bool mxs_log_init(const char* ident, const char* logdir, log_target_t target)
|
||||
bool mxs_log_init(const char* ident, const char* logdir, mxs_log_target_t target)
|
||||
{
|
||||
bool succ = false;
|
||||
|
||||
@ -627,12 +627,12 @@ static int logmanager_write_log(int priority,
|
||||
size_t cmplen = 0;
|
||||
/**
|
||||
* 2 braces, 2 spaces and terminating char
|
||||
* If session id is stored to tls_log_info structure, allocate
|
||||
* If session id is stored to mxs_log_tls structure, allocate
|
||||
* room for session id too.
|
||||
*/
|
||||
if ((priority == LOG_INFO) && (tls_log_info.li_sesid != 0))
|
||||
if ((priority == LOG_INFO) && (mxs_log_tls.li_sesid != 0))
|
||||
{
|
||||
sesid_str_len = 5 * sizeof(char) + get_decimal_len(tls_log_info.li_sesid);
|
||||
sesid_str_len = 5 * sizeof(char) + get_decimal_len(mxs_log_tls.li_sesid);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -729,7 +729,7 @@ static int logmanager_write_log(int priority,
|
||||
/**
|
||||
* Write session id
|
||||
*/
|
||||
snprintf(wp + timestamp_len, sesid_str_len, "[%lu] ", tls_log_info.li_sesid);
|
||||
snprintf(wp + timestamp_len, sesid_str_len, "[%lu] ", mxs_log_tls.li_sesid);
|
||||
sesid_str_len -= 1; /*< don't calculate terminating char anymore */
|
||||
}
|
||||
/**
|
||||
@ -1139,7 +1139,7 @@ static blockbuf_t* blockbuf_init()
|
||||
*/
|
||||
void mxs_log_set_augmentation(int bits)
|
||||
{
|
||||
log_config.augmentation = bits & LOG_AUGMENTATION_MASK;
|
||||
log_config.augmentation = bits & MXS_LOG_AUGMENTATION_MASK;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1232,7 +1232,7 @@ static bool logmanager_register(bool writep)
|
||||
// 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.
|
||||
succ = logmanager_init_nomutex(NULL, NULL, LOG_TARGET_DEFAULT);
|
||||
succ = logmanager_init_nomutex(NULL, NULL, MXS_LOG_TARGET_DEFAULT);
|
||||
}
|
||||
}
|
||||
/** if logmanager existed or was succesfully restarted, increase link */
|
||||
@ -1345,7 +1345,7 @@ static bool fnames_conf_init(fnames_conf_t* fn, const char* logdir)
|
||||
*/
|
||||
static bool logfiles_init(logmanager_t* lm)
|
||||
{
|
||||
bool store_shmem = (lm->lm_target == LOG_TARGET_SHMEM);
|
||||
bool store_shmem = (lm->lm_target == MXS_LOG_TARGET_SHMEM);
|
||||
|
||||
bool succ = logfile_init(&lm->lm_logfile, lm, store_shmem);
|
||||
|
||||
@ -1394,7 +1394,7 @@ static void logfile_rotate(logfile_t* lf)
|
||||
* using log manager in parallel with multiple processes and by configuring
|
||||
* log manager to use same directories among those processes.
|
||||
*/
|
||||
static bool logfile_create(logfile_t* lf)
|
||||
static bool logfile_build_name(logfile_t* lf)
|
||||
{
|
||||
bool namecreatefail;
|
||||
bool nameconflicts;
|
||||
@ -1897,7 +1897,7 @@ static bool logfile_init(logfile_t* logfile,
|
||||
}
|
||||
logfile->lf_filepath = add_slash(logfile->lf_filepath);
|
||||
|
||||
if (!(succ = logfile_create(logfile)))
|
||||
if (!(succ = logfile_build_name(logfile)))
|
||||
{
|
||||
goto return_with_succ;
|
||||
}
|
||||
@ -2084,7 +2084,7 @@ static bool thr_flush_file(logmanager_t *lm, filewriter_t *fwr)
|
||||
|
||||
lf->lf_name_seqno += 1; /*< new sequence number */
|
||||
|
||||
if (!(succ = logfile_create(lf)))
|
||||
if (!(succ = logfile_build_name(lf)))
|
||||
{
|
||||
lf->lf_name_seqno -= 1; /*< restore */
|
||||
}
|
||||
@ -2606,11 +2606,11 @@ int mxs_log_set_priority_enabled(int priority, bool enable)
|
||||
if (enable)
|
||||
{
|
||||
// TODO: Put behind spinlock.
|
||||
lm_enabled_priorities_bitmask |= bit;
|
||||
mxs_log_enabled_priorities |= bit;
|
||||
}
|
||||
else
|
||||
{
|
||||
lm_enabled_priorities_bitmask &= ~bit;
|
||||
mxs_log_enabled_priorities &= ~bit;
|
||||
}
|
||||
|
||||
MXS_NOTICE("The logging of %s messages has been %sd.", priority_name(priority), text);
|
||||
@ -2763,7 +2763,7 @@ int mxs_log_message(int priority,
|
||||
|
||||
switch (augmentation)
|
||||
{
|
||||
case LOG_AUGMENT_WITH_FUNCTION:
|
||||
case MXS_LOG_AUGMENT_WITH_FUNCTION:
|
||||
augmentation_len = sizeof(FORMAT_FUNCTION) - 1; // Remove trailing 0
|
||||
augmentation_len -= 2; // Remove the %s
|
||||
augmentation_len += strlen(function);
|
||||
@ -2797,7 +2797,7 @@ int mxs_log_message(int priority,
|
||||
|
||||
switch (augmentation)
|
||||
{
|
||||
case LOG_AUGMENT_WITH_FUNCTION:
|
||||
case MXS_LOG_AUGMENT_WITH_FUNCTION:
|
||||
len = sprintf(augmentation_text, FORMAT_FUNCTION, function);
|
||||
break;
|
||||
|
||||
|
@ -48,43 +48,43 @@ enum mxs_log_priorities
|
||||
|
||||
typedef enum
|
||||
{
|
||||
LOG_TARGET_DEFAULT = 0,
|
||||
LOG_TARGET_FS = 1, // File system
|
||||
LOG_TARGET_SHMEM = 2, // Shared memory
|
||||
} log_target_t;
|
||||
MXS_LOG_TARGET_DEFAULT = 0,
|
||||
MXS_LOG_TARGET_FS = 1, // File system
|
||||
MXS_LOG_TARGET_SHMEM = 2, // Shared memory
|
||||
} mxs_log_target_t;
|
||||
|
||||
/**
|
||||
* Thread-specific logging information.
|
||||
*/
|
||||
typedef struct log_info
|
||||
typedef struct mxs_log_info
|
||||
{
|
||||
size_t li_sesid;
|
||||
int li_enabled_priorities;
|
||||
} log_info_t;
|
||||
} mxs_log_info_t;
|
||||
|
||||
extern int lm_enabled_priorities_bitmask;
|
||||
extern ssize_t log_ses_count[];
|
||||
extern __thread log_info_t tls_log_info;
|
||||
extern int mxs_log_enabled_priorities;
|
||||
extern ssize_t mxs_log_session_count[];
|
||||
extern __thread mxs_log_info_t mxs_log_tls;
|
||||
|
||||
/**
|
||||
* Check if specified log type is enabled in general or if it is enabled
|
||||
* for the current session.
|
||||
*/
|
||||
#define MXS_LOG_PRIORITY_IS_ENABLED(priority) \
|
||||
(((lm_enabled_priorities_bitmask & (1 << priority)) || \
|
||||
(log_ses_count[priority] > 0 && \
|
||||
tls_log_info.li_enabled_priorities & (1 << priority))) ? true : false)
|
||||
(((mxs_log_enabled_priorities & (1 << priority)) || \
|
||||
(mxs_log_session_count[priority] > 0 && \
|
||||
mxs_log_tls.li_enabled_priorities & (1 << priority))) ? true : false)
|
||||
|
||||
/**
|
||||
* LOG_AUGMENT_WITH_FUNCTION Each logged line is suffixed with [function-name].
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
LOG_AUGMENT_WITH_FUNCTION = 1,
|
||||
LOG_AUGMENTATION_MASK = (LOG_AUGMENT_WITH_FUNCTION)
|
||||
} log_augmentation_t;
|
||||
MXS_LOG_AUGMENT_WITH_FUNCTION = 1,
|
||||
MXS_LOG_AUGMENTATION_MASK = (MXS_LOG_AUGMENT_WITH_FUNCTION)
|
||||
} mxs_log_augmentation_t;
|
||||
|
||||
bool mxs_log_init(const char* ident, const char* logdir, log_target_t target);
|
||||
bool mxs_log_init(const char* ident, const char* logdir, mxs_log_target_t target);
|
||||
void mxs_log_finish(void);
|
||||
|
||||
int mxs_log_flush();
|
||||
|
@ -130,7 +130,7 @@ int main(int argc, char* argv[])
|
||||
fprintf(stderr, "Couldn't register exit function.\n");
|
||||
}
|
||||
|
||||
succp = mxs_log_init(NULL, "/tmp", LOG_TARGET_FS);
|
||||
succp = mxs_log_init(NULL, "/tmp", MXS_LOG_TARGET_FS);
|
||||
|
||||
if (!succp)
|
||||
{
|
||||
@ -148,7 +148,7 @@ int main(int argc, char* argv[])
|
||||
tm.tm_min,
|
||||
tm.tm_sec);
|
||||
|
||||
mxs_log_init(NULL, "/tmp", LOG_TARGET_FS);
|
||||
mxs_log_init(NULL, "/tmp", MXS_LOG_TARGET_FS);
|
||||
logstr = ("First write with flush.");
|
||||
err = MXS_ERROR("%s", logstr);
|
||||
|
||||
@ -196,7 +196,7 @@ int main(int argc, char* argv[])
|
||||
logstr = "Ph%dlip.";
|
||||
err = MXS_INFO(logstr, 1);
|
||||
|
||||
mxs_log_init(NULL, "/tmp", LOG_TARGET_FS);
|
||||
mxs_log_init(NULL, "/tmp", MXS_LOG_TARGET_FS);
|
||||
logstr = ("A terrible error has occurred!");
|
||||
err = MXS_ERROR("%s", logstr);
|
||||
|
||||
@ -342,7 +342,7 @@ int main(int argc, char* argv[])
|
||||
#if !defined(SS_DEBUG)
|
||||
skygw_log_enable(LOG_INFO);
|
||||
#endif
|
||||
succp = mxs_log_init(NULL, "/tmp", LOG_TARGET_FS);
|
||||
succp = mxs_log_init(NULL, "/tmp", MXS_LOG_TARGET_FS);
|
||||
ss_dassert(succp);
|
||||
|
||||
logstr = ("\tTEST 3 - test enabling and disabling logs.");
|
||||
@ -407,7 +407,7 @@ int main(int argc, char* argv[])
|
||||
#endif /* TEST 3 */
|
||||
|
||||
#if defined(TEST4)
|
||||
succp = mxs_log_init(NULL, "/tmp", LOG_TARGET_FS);
|
||||
succp = mxs_log_init(NULL, "/tmp", MXS_LOG_TARGET_FS);
|
||||
ss_dassert(succp);
|
||||
#if !defined(SS_DEBUG)
|
||||
skygw_log_enable(LOG_INFO);
|
||||
@ -443,7 +443,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
mxs_log_finish();
|
||||
|
||||
succp = mxs_log_init(NULL, "/tmp", LOG_TARGET_FS);
|
||||
succp = mxs_log_init(NULL, "/tmp", MXS_LOG_TARGET_FS);
|
||||
ss_dassert(succp);
|
||||
#if !defined(SS_DEBUG)
|
||||
skygw_log_enable(LOG_INFO);
|
||||
@ -513,7 +513,7 @@ static void* thr_run(void* data)
|
||||
char* logstr;
|
||||
int err;
|
||||
|
||||
mxs_log_init(NULL, "/tmp", LOG_TARGET_FS);
|
||||
mxs_log_init(NULL, "/tmp", MXS_LOG_TARGET_FS);
|
||||
mxs_log_flush();
|
||||
logstr = ("Hi, how are you?");
|
||||
err = MXS_NOTICE("%s", logstr);
|
||||
@ -536,7 +536,7 @@ static void* thr_run(void* data)
|
||||
}
|
||||
ss_dassert(err == 0);
|
||||
err = MXS_NOTICE("%s", logstr);
|
||||
mxs_log_init(NULL, "/tmp", LOG_TARGET_FS);
|
||||
mxs_log_init(NULL, "/tmp", MXS_LOG_TARGET_FS);
|
||||
logstr = ("Testing. One, two, three\n");
|
||||
err = MXS_ERROR("%s", logstr);
|
||||
if (err != 0)
|
||||
@ -544,8 +544,8 @@ static void* thr_run(void* data)
|
||||
TEST_ERROR("Error, log write failed.");
|
||||
}
|
||||
ss_dassert(err == 0);
|
||||
mxs_log_init(NULL, "/tmp", LOG_TARGET_FS);
|
||||
mxs_log_init(NULL, "/tmp", LOG_TARGET_FS);
|
||||
mxs_log_init(NULL, "/tmp", MXS_LOG_TARGET_FS);
|
||||
mxs_log_init(NULL, "/tmp", MXS_LOG_TARGET_FS);
|
||||
mxs_log_flush();
|
||||
logstr = ("For automatic and register variables, it is done each time the function or block is entered.");
|
||||
|
||||
@ -559,7 +559,7 @@ static void* thr_run(void* data)
|
||||
}
|
||||
ss_dassert(err == 0);
|
||||
mxs_log_finish();
|
||||
mxs_log_init(NULL, "/tmp", LOG_TARGET_FS);
|
||||
mxs_log_init(NULL, "/tmp", MXS_LOG_TARGET_FS);
|
||||
logstr = ("Rather more surprising, at least at first sight, is the fact that a reference "
|
||||
"to a[i] can also be written as *(a+i). In evaluating a[i], C converts it to *(a+i) "
|
||||
"immediately; the two forms are equivalent. Applying the operatos & to both parts "
|
||||
@ -571,11 +571,11 @@ static void* thr_run(void* data)
|
||||
TEST_ERROR("Error, log write failed.");
|
||||
}
|
||||
ss_dassert(err == 0);
|
||||
mxs_log_init(NULL, "/tmp", LOG_TARGET_FS);
|
||||
mxs_log_init(NULL, "/tmp", MXS_LOG_TARGET_FS);
|
||||
mxs_log_finish();
|
||||
mxs_log_flush();
|
||||
mxs_log_finish();
|
||||
mxs_log_init(NULL, "/tmp", LOG_TARGET_FS);
|
||||
mxs_log_init(NULL, "/tmp", MXS_LOG_TARGET_FS);
|
||||
logstr = ("..and you?");
|
||||
err = MXS_NOTICE("%s", logstr);
|
||||
if (err != 0)
|
||||
@ -584,7 +584,7 @@ static void* thr_run(void* data)
|
||||
}
|
||||
ss_dassert(err == 0);
|
||||
mxs_log_finish();
|
||||
mxs_log_init(NULL, "/tmp", LOG_TARGET_FS);
|
||||
mxs_log_init(NULL, "/tmp", MXS_LOG_TARGET_FS);
|
||||
logstr = ("For automatic and register variables, it is done each time the function or block is entered.");
|
||||
#if !defined(SS_DEBUG)
|
||||
skygw_log_enable(LOG_INFO);
|
||||
@ -595,7 +595,7 @@ static void* thr_run(void* data)
|
||||
TEST_ERROR("Error, log write failed.");
|
||||
}
|
||||
ss_dassert(err == 0);
|
||||
mxs_log_init(NULL, "/tmp", LOG_TARGET_FS);
|
||||
mxs_log_init(NULL, "/tmp", MXS_LOG_TARGET_FS);
|
||||
logstr = ("Rather more surprising, at least at first sight, is the fact that a reference to "
|
||||
"a[i] can also be written as *(a+i). In evaluating a[i], C converts it to *(a+i) "
|
||||
"immediately; the two forms are equivalent. Applying the operatos & to both parts "
|
||||
@ -607,7 +607,7 @@ static void* thr_run(void* data)
|
||||
TEST_ERROR("Error, log write failed.");
|
||||
}
|
||||
ss_dassert(err == 0);
|
||||
mxs_log_init(NULL, "/tmp", LOG_TARGET_FS);
|
||||
mxs_log_init(NULL, "/tmp", MXS_LOG_TARGET_FS);
|
||||
logstr = ("..... and you too?");
|
||||
err = MXS_NOTICE("%s", logstr);
|
||||
if (err != 0)
|
||||
@ -616,7 +616,7 @@ static void* thr_run(void* data)
|
||||
}
|
||||
ss_dassert(err == 0);
|
||||
mxs_log_finish();
|
||||
mxs_log_init(NULL, "/tmp", LOG_TARGET_FS);
|
||||
mxs_log_init(NULL, "/tmp", MXS_LOG_TARGET_FS);
|
||||
#if !defined(SS_DEBUG)
|
||||
skygw_log_enable(LOG_INFO);
|
||||
#endif
|
||||
@ -632,7 +632,7 @@ static void* thr_run(void* data)
|
||||
}
|
||||
ss_dassert(err == 0);
|
||||
mxs_log_finish();
|
||||
mxs_log_init(NULL, "/tmp", LOG_TARGET_FS);
|
||||
mxs_log_init(NULL, "/tmp", MXS_LOG_TARGET_FS);
|
||||
logstr = ("Testing. One, two, three, four\n");
|
||||
err = MXS_ERROR("%s", logstr);
|
||||
if (err != 0)
|
||||
@ -641,7 +641,7 @@ static void* thr_run(void* data)
|
||||
}
|
||||
ss_dassert(err == 0);
|
||||
mxs_log_finish();
|
||||
mxs_log_init(NULL, "/tmp", LOG_TARGET_FS);
|
||||
mxs_log_init(NULL, "/tmp", MXS_LOG_TARGET_FS);
|
||||
logstr = ("Testing. One, two, three, .. where was I?\n");
|
||||
err = MXS_ERROR("%s", logstr);
|
||||
if (err != 0)
|
||||
@ -650,7 +650,7 @@ static void* thr_run(void* data)
|
||||
}
|
||||
ss_dassert(err == 0);
|
||||
mxs_log_finish();
|
||||
mxs_log_init(NULL, "/tmp", LOG_TARGET_FS);
|
||||
mxs_log_init(NULL, "/tmp", MXS_LOG_TARGET_FS);
|
||||
mxs_log_finish();
|
||||
simple_mutex_lock(td->mtx, true);
|
||||
*td->nactive -= 1;
|
||||
|
@ -77,7 +77,7 @@ int main(int argc, char** argv)
|
||||
iterations = atoi(argv[1]);
|
||||
interval = atoi(argv[2]);
|
||||
|
||||
succp = mxs_log_init(NULL, tmp, LOG_TARGET_FS);
|
||||
succp = mxs_log_init(NULL, tmp, MXS_LOG_TARGET_FS);
|
||||
|
||||
if (!succp)
|
||||
{
|
||||
|
@ -619,8 +619,8 @@ dcb_process_victim_queue(DCB *listofdcb)
|
||||
}
|
||||
|
||||
dcb_get_ses_log_info(dcb,
|
||||
&tls_log_info.li_sesid,
|
||||
&tls_log_info.li_enabled_priorities);
|
||||
&mxs_log_tls.li_sesid,
|
||||
&mxs_log_tls.li_enabled_priorities);
|
||||
|
||||
dcb->state = DCB_STATE_DISCONNECTED;
|
||||
nextdcb = dcb->memdata.next;
|
||||
@ -629,7 +629,7 @@ dcb_process_victim_queue(DCB *listofdcb)
|
||||
dcb = nextdcb;
|
||||
}
|
||||
/** Reset threads session data */
|
||||
tls_log_info.li_sesid = 0;
|
||||
mxs_log_tls.li_sesid = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1032,7 +1032,7 @@ int main(int argc, char **argv)
|
||||
char* tmp_path;
|
||||
char* tmp_var;
|
||||
int option_index;
|
||||
log_target_t log_target = LOG_TARGET_FS;
|
||||
mxs_log_target_t log_target = MXS_LOG_TARGET_FS;
|
||||
int *syslog_enabled = &config_get_global_options()->syslog; /** Log to syslog */
|
||||
int *maxscalelog_enabled = &config_get_global_options()->maxlog; /** Log with MaxScale */
|
||||
ssize_t log_flush_timeout_ms = 0;
|
||||
@ -1121,9 +1121,9 @@ int main(int argc, char **argv)
|
||||
|
||||
case 'l':
|
||||
if (strncasecmp(optarg, "file", PATH_MAX) == 0)
|
||||
log_target = LOG_TARGET_FS;
|
||||
log_target = MXS_LOG_TARGET_FS;
|
||||
else if (strncasecmp(optarg, "shm", PATH_MAX) == 0)
|
||||
log_target = LOG_TARGET_SHMEM;
|
||||
log_target = MXS_LOG_TARGET_SHMEM;
|
||||
else
|
||||
{
|
||||
char* logerr = "Configuration file argument "
|
||||
|
@ -48,7 +48,7 @@ int main(int argc, char **argv)
|
||||
keyfile = argv[1];
|
||||
}
|
||||
|
||||
mxs_log_init(NULL, NULL, LOG_TARGET_DEFAULT);
|
||||
mxs_log_init(NULL, NULL, MXS_LOG_TARGET_DEFAULT);
|
||||
|
||||
if (secrets_writeKeys(keyfile))
|
||||
{
|
||||
|
@ -51,7 +51,7 @@ main(int argc, char **argv)
|
||||
return 1;
|
||||
}
|
||||
|
||||
mxs_log_init(NULL, NULL, LOG_TARGET_DEFAULT);
|
||||
mxs_log_init(NULL, NULL, MXS_LOG_TARGET_DEFAULT);
|
||||
|
||||
pw = calloc(81, sizeof(char));
|
||||
|
||||
|
@ -859,8 +859,8 @@ unsigned long qtime;
|
||||
atomic_add(&pollStats.n_write, 1);
|
||||
/** Read session id to thread's local storage */
|
||||
dcb_get_ses_log_info(dcb,
|
||||
&tls_log_info.li_sesid,
|
||||
&tls_log_info.li_enabled_priorities);
|
||||
&mxs_log_tls.li_sesid,
|
||||
&mxs_log_tls.li_enabled_priorities);
|
||||
|
||||
if (poll_dcb_session_check(dcb, "write_ready"))
|
||||
{
|
||||
@ -889,8 +889,8 @@ unsigned long qtime;
|
||||
atomic_add(
|
||||
&pollStats.n_accept, 1);
|
||||
dcb_get_ses_log_info(dcb,
|
||||
&tls_log_info.li_sesid,
|
||||
&tls_log_info.li_enabled_priorities);
|
||||
&mxs_log_tls.li_sesid,
|
||||
&mxs_log_tls.li_enabled_priorities);
|
||||
|
||||
if (poll_dcb_session_check(dcb, "accept"))
|
||||
{
|
||||
@ -907,8 +907,8 @@ unsigned long qtime;
|
||||
atomic_add(&pollStats.n_read, 1);
|
||||
/** Read session id to thread's local storage */
|
||||
dcb_get_ses_log_info(dcb,
|
||||
&tls_log_info.li_sesid,
|
||||
&tls_log_info.li_enabled_priorities);
|
||||
&mxs_log_tls.li_sesid,
|
||||
&mxs_log_tls.li_enabled_priorities);
|
||||
|
||||
if (poll_dcb_session_check(dcb, "read"))
|
||||
{
|
||||
@ -943,8 +943,8 @@ unsigned long qtime;
|
||||
atomic_add(&pollStats.n_error, 1);
|
||||
/** Read session id to thread's local storage */
|
||||
dcb_get_ses_log_info(dcb,
|
||||
&tls_log_info.li_sesid,
|
||||
&tls_log_info.li_enabled_priorities);
|
||||
&mxs_log_tls.li_sesid,
|
||||
&mxs_log_tls.li_enabled_priorities);
|
||||
|
||||
if (poll_dcb_session_check(dcb, "error"))
|
||||
{
|
||||
@ -973,8 +973,8 @@ unsigned long qtime;
|
||||
spinlock_release(&dcb->dcb_initlock);
|
||||
/** Read session id to thread's local storage */
|
||||
dcb_get_ses_log_info(dcb,
|
||||
&tls_log_info.li_sesid,
|
||||
&tls_log_info.li_enabled_priorities);
|
||||
&mxs_log_tls.li_sesid,
|
||||
&mxs_log_tls.li_enabled_priorities);
|
||||
|
||||
if (poll_dcb_session_check(dcb, "hangup EPOLLHUP"))
|
||||
{
|
||||
@ -1007,8 +1007,8 @@ unsigned long qtime;
|
||||
spinlock_release(&dcb->dcb_initlock);
|
||||
/** Read session id to thread's local storage */
|
||||
dcb_get_ses_log_info(dcb,
|
||||
&tls_log_info.li_sesid,
|
||||
&tls_log_info.li_enabled_priorities);
|
||||
&mxs_log_tls.li_sesid,
|
||||
&mxs_log_tls.li_enabled_priorities);
|
||||
|
||||
if (poll_dcb_session_check(dcb, "hangup EPOLLRDHUP"))
|
||||
{
|
||||
@ -1075,7 +1075,7 @@ unsigned long qtime;
|
||||
}
|
||||
dcb->evq.processing = 0;
|
||||
/** Reset session id from thread's local storage */
|
||||
tls_log_info.li_sesid = 0;
|
||||
mxs_log_tls.li_sesid = 0;
|
||||
spinlock_release(&pollqlock);
|
||||
|
||||
return 1;
|
||||
|
@ -271,7 +271,7 @@ session_set_dummy(DCB *client_dcb)
|
||||
void session_enable_log_priority(SESSION* ses, int priority)
|
||||
{
|
||||
ses->enabled_log_priorities |= (1 << priority);
|
||||
atomic_add((int *)&log_ses_count[priority], 1);
|
||||
atomic_add((int *)&mxs_log_session_count[priority], 1);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -287,7 +287,7 @@ void session_disable_log_priority(SESSION* ses, int priority)
|
||||
if (ses->enabled_log_priorities & (1 << priority))
|
||||
{
|
||||
ses->enabled_log_priorities &= ~(1 << priority);
|
||||
atomic_add((int *)&log_ses_count[priority], -1);
|
||||
atomic_add((int *)&mxs_log_session_count[priority], -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ void init_test_env(char *path)
|
||||
|
||||
const char* logdir = path ? path : TEST_LOG_DIR;
|
||||
|
||||
mxs_log_init(NULL, logdir, LOG_TARGET_DEFAULT);
|
||||
mxs_log_init(NULL, logdir, MXS_LOG_TARGET_DEFAULT);
|
||||
poll_init();
|
||||
hkinit();
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ int harness_init(int argc, char** argv, HARNESS_INSTANCE** inst){
|
||||
char tmp[2048];
|
||||
|
||||
if(!(argc == 2 && strcmp(argv[1],"-h") == 0)){
|
||||
mxs_log_init(NULL,NULL,LOG_TARGET_DEFAULT);
|
||||
mxs_log_init(NULL,NULL,MXS_LOG_TARGET_DEFAULT);
|
||||
}
|
||||
|
||||
if(!(instance.head = calloc(1,sizeof(FILTERCHAIN))))
|
||||
@ -51,7 +51,7 @@ int harness_init(int argc, char** argv, HARNESS_INSTANCE** inst){
|
||||
getcwd(cwd,sizeof(cwd));
|
||||
sprintf(tmp,"%s",cwd);
|
||||
|
||||
mxs_log_init(NULL, tmp, LOG_TARGET_DEFAULT);
|
||||
mxs_log_init(NULL, tmp, MXS_LOG_TARGET_DEFAULT);
|
||||
|
||||
rval = process_opts(argc,argv);
|
||||
|
||||
|
@ -124,7 +124,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
num_args = optind;
|
||||
|
||||
mxs_log_init(NULL, NULL, LOG_TARGET_DEFAULT);
|
||||
mxs_log_init(NULL, NULL, MXS_LOG_TARGET_DEFAULT);
|
||||
mxs_log_set_augmentation(0);
|
||||
mxs_log_set_priority_enabled(LOG_DEBUG, debug_out);
|
||||
|
||||
|
@ -89,7 +89,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
roptions = strdup("server-id=3,heartbeat=200,binlogdir=/not_exists/my_dir,transaction_safety=1,master_version=5.6.99-common,master_hostname=common_server,master_uuid=xxx-fff-cccc-fff,master-id=999");
|
||||
|
||||
mxs_log_init(NULL, NULL, LOG_TARGET_DEFAULT);
|
||||
mxs_log_init(NULL, NULL, MXS_LOG_TARGET_DEFAULT);
|
||||
|
||||
mxs_log_set_priority_enabled(LOG_DEBUG, false);
|
||||
mxs_log_set_priority_enabled(LOG_INFO, false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user