My Project
Classes | Defines | Functions | Variables
log.cc File Reference

logging of commands More...

#include "my_global.h"
#include "sql_priv.h"
#include "log.h"
#include "sql_base.h"
#include "sql_delete.h"
#include "sql_parse.h"
#include "sql_time.h"
#include "tztime.h"
#include "sql_acl.h"
#include "sql_audit.h"
#include "mysql/service_my_plugin_log.h"
#include <my_dir.h>
#include <stdarg.h>
#include <m_ctype.h>

Classes

class  Slow_query_log_table_intact
class  General_log_table_intact
class  Silence_log_table_errors

Defines

#define MAX_LOG_BUFFER_SIZE   1024
#define MAX_TIME_SIZE   32

Functions

uint purge_log_get_error_code (int res)
char * make_log_name (char *buff, const char *name, const char *log_ext)
int check_if_log_table (size_t db_len, const char *db, size_t table_name_len, const char *table_name, bool check_if_opened)
int error_log_print (enum loglevel level, const char *format, va_list args)
bool slow_log_print (THD *thd, const char *query, uint query_length)
bool general_log_print (THD *thd, enum enum_server_command command, const char *format,...)
bool general_log_write (THD *thd, enum enum_server_command command, const char *query, uint query_length)
void sql_perror (const char *message)
my_bool reopen_fstreams (const char *filename, FILE *outstream, FILE *errstream)
bool flush_error_log ()
int vprint_msg_to_log (enum loglevel level, const char *format, va_list args)
void sql_print_error (const char *format,...)
void sql_print_warning (const char *format,...)
void sql_print_information (const char *format,...)
int my_plugin_log_message (MYSQL_PLUGIN *plugin_ptr, plugin_log_level level, const char *format,...)

Variables

LOGGER logger
sql_print_message_func sql_print_message_handlers [3]
ulong tc_log_page_waits = 0
TC_LOGtc_log
TC_LOG_DUMMY tc_log_dummy
TC_LOG_MMAP tc_log_mmap

Detailed Description

logging of commands

Todo:
Abort logging when we get an error in reading or writing log files

Function Documentation

char* make_log_name ( char *  buff,
const char *  name,
const char *  log_ext 
)

Create the name of the log specified.

This method forms a new path + file name for the log specified in name.

Parameters:
IN]buff Location for building new string.
IN]name Name of the log file.
IN]log_ext The extension for the log (e.g. .log).
Returns:
Pointer to new string containing the name.
uint purge_log_get_error_code ( int  res)

purge logs, master and slave sides both, related error code convertor. Called from purge_error_message(), MYSQL_BIN_LOG::reset_logs()

Parameters:
resan internal to purging routines error code
Returns:
the user level error code ER_*
int vprint_msg_to_log ( enum loglevel  level,
const char *  format,
va_list  args 
)

Prints a printf style message to the error log and, under NT, to the Windows event log.

This function prints the message into a buffer and then sends that buffer to other functions to write that message to other logging sources.

Parameters:
levelThe level of the msg significance
formatPrintf style format of message
argsva_list list of arguments for the message
Returns:
The function always returns 0. The return value is present in the signature to be compatible with other logging routines, which could return an error (e.g. logging to the log tables)

Variable Documentation

sql_print_message_func sql_print_message_handlers[3]
Initial value:
{
  sql_print_information,
  sql_print_warning,
  sql_print_error
}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines