Remove all traces of logfile_t
The earlier log file based approach for enabling and disabling messages has now been completely replaced with the syslog priority based approach. Similarly as with log files before it is now possible to enable and disable a log priority for a particular session, even though it apparently has not been used much. The local test-programs of the logging has got minimal attention only to make them compile. They should get an overhaul as they did not work before either.
This commit is contained in:
@ -127,23 +127,23 @@ size_t dcb_get_session_id(
|
||||
* Read log info from session through DCB and store values to memory locations
|
||||
* passed as parameters.
|
||||
*
|
||||
* @param dcb DCB
|
||||
* @param sesid location where session id is to be copied
|
||||
* @param enabled_logs bit field indicating which log types are enabled for the
|
||||
* @param dcb DCB
|
||||
* @param sesid location where session id is to be copied
|
||||
* @param enabled_log_prioritiess bit field indicating which log types are enabled for the
|
||||
* session
|
||||
*
|
||||
*@return true if call arguments included memory addresses, false if any of the
|
||||
*parameters was NULL.
|
||||
*/
|
||||
*@return true if call arguments included memory addresses, false if any of the
|
||||
* parameters was NULL.
|
||||
*/
|
||||
bool dcb_get_ses_log_info(
|
||||
DCB *dcb,
|
||||
size_t *sesid,
|
||||
int *enabled_logs)
|
||||
int *enabled_log_priorities)
|
||||
{
|
||||
if (sesid && enabled_logs && dcb && dcb->session)
|
||||
if (sesid && enabled_log_priorities && dcb && dcb->session)
|
||||
{
|
||||
*sesid = dcb->session->ses_id;
|
||||
*enabled_logs = dcb->session->ses_enabled_logs;
|
||||
*enabled_log_priorities = dcb->session->enabled_log_priorities;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@ -620,7 +620,7 @@ dcb_process_victim_queue(DCB *listofdcb)
|
||||
|
||||
dcb_get_ses_log_info(dcb,
|
||||
&tls_log_info.li_sesid,
|
||||
&tls_log_info.li_enabled_logs);
|
||||
&tls_log_info.li_enabled_priorities);
|
||||
|
||||
dcb->state = DCB_STATE_DISCONNECTED;
|
||||
nextdcb = dcb->memdata.next;
|
||||
@ -1247,7 +1247,7 @@ dcb_write_when_already_queued(DCB *dcb, GWBUF *queue)
|
||||
static void
|
||||
dcb_log_write_failure(DCB *dcb, GWBUF *queue, int eno)
|
||||
{
|
||||
if (LOG_IS_ENABLED(LOGFILE_DEBUG))
|
||||
if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_DEBUG))
|
||||
{
|
||||
if (eno == EPIPE)
|
||||
{
|
||||
@ -1264,7 +1264,7 @@ dcb_log_write_failure(DCB *dcb, GWBUF *queue, int eno)
|
||||
}
|
||||
}
|
||||
|
||||
if (LOG_IS_ENABLED(LOGFILE_ERROR))
|
||||
if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_ERR))
|
||||
{
|
||||
if (eno != EPIPE &&
|
||||
eno != EAGAIN &&
|
||||
@ -1430,7 +1430,7 @@ dcb_write_SSL_error_report (DCB *dcb, int ret, int ssl_errno)
|
||||
{
|
||||
char errbuf[STRERROR_BUFLEN];
|
||||
|
||||
if (LOG_IS_ENABLED(LOGFILE_DEBUG))
|
||||
if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_DEBUG))
|
||||
{
|
||||
switch(ssl_errno)
|
||||
{
|
||||
@ -1464,7 +1464,7 @@ dcb_write_SSL_error_report (DCB *dcb, int ret, int ssl_errno)
|
||||
}
|
||||
}
|
||||
|
||||
if (LOG_IS_ENABLED(LOGFILE_ERROR) && ssl_errno != SSL_ERROR_WANT_WRITE)
|
||||
if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_ERR) && ssl_errno != SSL_ERROR_WANT_WRITE)
|
||||
{
|
||||
if (ret == -1)
|
||||
{
|
||||
|
||||
@ -860,7 +860,7 @@ unsigned long qtime;
|
||||
/** Read session id to thread's local storage */
|
||||
dcb_get_ses_log_info(dcb,
|
||||
&tls_log_info.li_sesid,
|
||||
&tls_log_info.li_enabled_logs);
|
||||
&tls_log_info.li_enabled_priorities);
|
||||
|
||||
if (poll_dcb_session_check(dcb, "write_ready"))
|
||||
{
|
||||
@ -890,7 +890,7 @@ unsigned long qtime;
|
||||
&pollStats.n_accept, 1);
|
||||
dcb_get_ses_log_info(dcb,
|
||||
&tls_log_info.li_sesid,
|
||||
&tls_log_info.li_enabled_logs);
|
||||
&tls_log_info.li_enabled_priorities);
|
||||
|
||||
if (poll_dcb_session_check(dcb, "accept"))
|
||||
{
|
||||
@ -908,7 +908,7 @@ unsigned long qtime;
|
||||
/** Read session id to thread's local storage */
|
||||
dcb_get_ses_log_info(dcb,
|
||||
&tls_log_info.li_sesid,
|
||||
&tls_log_info.li_enabled_logs);
|
||||
&tls_log_info.li_enabled_priorities);
|
||||
|
||||
if (poll_dcb_session_check(dcb, "read"))
|
||||
{
|
||||
@ -944,7 +944,7 @@ unsigned long qtime;
|
||||
/** Read session id to thread's local storage */
|
||||
dcb_get_ses_log_info(dcb,
|
||||
&tls_log_info.li_sesid,
|
||||
&tls_log_info.li_enabled_logs);
|
||||
&tls_log_info.li_enabled_priorities);
|
||||
|
||||
if (poll_dcb_session_check(dcb, "error"))
|
||||
{
|
||||
@ -974,7 +974,7 @@ unsigned long qtime;
|
||||
/** Read session id to thread's local storage */
|
||||
dcb_get_ses_log_info(dcb,
|
||||
&tls_log_info.li_sesid,
|
||||
&tls_log_info.li_enabled_logs);
|
||||
&tls_log_info.li_enabled_priorities);
|
||||
|
||||
if (poll_dcb_session_check(dcb, "hangup EPOLLHUP"))
|
||||
{
|
||||
@ -1008,7 +1008,7 @@ unsigned long qtime;
|
||||
/** Read session id to thread's local storage */
|
||||
dcb_get_ses_log_info(dcb,
|
||||
&tls_log_info.li_sesid,
|
||||
&tls_log_info.li_enabled_logs);
|
||||
&tls_log_info.li_enabled_priorities);
|
||||
|
||||
if (poll_dcb_session_check(dcb, "hangup EPOLLRDHUP"))
|
||||
{
|
||||
|
||||
@ -261,38 +261,34 @@ session_set_dummy(DCB *client_dcb)
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable specified logging for the current session and increase logger
|
||||
* Enable specified log priority for the current session and increase logger
|
||||
* counter.
|
||||
* Generic logging setting has precedence over session-specific setting.
|
||||
*
|
||||
* @param ses session
|
||||
* @param id logfile identifier
|
||||
*
|
||||
* @param ses session
|
||||
* @param priority syslog priority
|
||||
*/
|
||||
void session_enable_log(
|
||||
SESSION* ses,
|
||||
logfile_id_t id)
|
||||
void session_enable_log_priority(SESSION* ses, int priority)
|
||||
{
|
||||
ses->ses_enabled_logs |= id;
|
||||
atomic_add((int *)&log_ses_count[id], 1);
|
||||
ses->enabled_log_priorities |= (1 << priority);
|
||||
atomic_add((int *)&log_ses_count[priority], 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* Disable specified logging for the current session and decrease logger
|
||||
* Disable specified log priority for the current session and decrease logger
|
||||
* counter.
|
||||
* Generic logging setting has precedence over session-specific setting.
|
||||
*
|
||||
*
|
||||
* @param ses session
|
||||
* @param id logfile identifier
|
||||
* @param priority syslog priority
|
||||
*/
|
||||
void session_disable_log(
|
||||
SESSION* ses,
|
||||
logfile_id_t id)
|
||||
void session_disable_log_priority(SESSION* ses, int priority)
|
||||
{
|
||||
if (ses->ses_enabled_logs & id)
|
||||
{
|
||||
ses->ses_enabled_logs &= ~id;
|
||||
atomic_add((int *)&log_ses_count[id], -1);
|
||||
}
|
||||
if (ses->enabled_log_priorities & (1 << priority))
|
||||
{
|
||||
ses->enabled_log_priorities &= ~(1 << priority);
|
||||
atomic_add((int *)&log_ses_count[priority], -1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -473,7 +469,7 @@ session_free(SESSION *session)
|
||||
session->ses_id);
|
||||
|
||||
/** Disable trace and decrease trace logger counter */
|
||||
session_disable_log(session, LT);
|
||||
session_disable_log_priority(session, LOG_INFO);
|
||||
|
||||
/** If session doesn't have parent referencing to it, it can be freed */
|
||||
if (!session->ses_is_child)
|
||||
|
||||
Reference in New Issue
Block a user