MySQL  8.0.27
Source Code Documentation
File_query_log Class Reference

Private Member Functions

 File_query_log (enum_log_table_type log_type)
 
 ~File_query_log ()
 
bool is_open () const
 
bool open ()
 Open a (new) log file. More...
 
void close ()
 Close the log file. More...
 
bool set_file (const char *new_name)
 Change what file we log to. More...
 
void check_and_print_write_error ()
 Check if we have already printed ER_ERROR_ON_WRITE and if not, do so. More...
 
bool write_general (ulonglong event_utime, my_thread_id thread_id, const char *command_type, size_t command_type_len, const char *sql_text, size_t sql_text_len)
 Write a command to traditional general log file. More...
 
bool write_slow (THD *thd, ulonglong current_utime, ulonglong query_start_utime, const char *user_host, size_t user_host_len, ulonglong query_utime, ulonglong lock_utime, bool is_command, const char *sql_text, size_t sql_text_len, struct System_status_var *query_start)
 Log a query to the traditional slow log file. More...
 

Private Attributes

const enum_log_table_type m_log_type
 Type of log file. More...
 
mysql_mutex_t LOCK_log
 Makes sure we only have one write at a time. More...
 
char * name
 Log filename. More...
 
char log_file_name [FN_REFLEN]
 Path to log file. More...
 
char db [NAME_LEN+1]
 Last seen current database. More...
 
bool write_error
 Have we already printed ER_ERROR_ON_WRITE? More...
 
IO_CACHE log_file
 
volatile bool log_open
 True if the file log is open, false otherwise. More...
 
PSI_file_key m_log_file_key
 Instrumentation key to use for file io in log_file. More...
 

Friends

class Log_to_file_event_handler
 
class Query_logger
 

Constructor & Destructor Documentation

◆ File_query_log()

File_query_log::File_query_log ( enum_log_table_type  log_type)
private

◆ ~File_query_log()

File_query_log::~File_query_log ( )
inlineprivate

Member Function Documentation

◆ check_and_print_write_error()

void File_query_log::check_and_print_write_error ( )
private

Check if we have already printed ER_ERROR_ON_WRITE and if not, do so.

◆ close()

void File_query_log::close ( void  )
private

Close the log file.

Note
One can do an open on the object at once after doing a close. The internal structures are not freed until the destructor is called.

◆ is_open()

bool File_query_log::is_open ( ) const
inlineprivate
Returns
true if the file log is open, false otherwise.

◆ open()

bool File_query_log::open ( )
private

Open a (new) log file.

Open the logfile, init IO_CACHE and write startup messages.

Returns
true if error, false otherwise.

◆ set_file()

bool File_query_log::set_file ( const char *  new_name)
private

Change what file we log to.

◆ write_general()

bool File_query_log::write_general ( ulonglong  event_utime,
my_thread_id  thread_id,
const char *  command_type,
size_t  command_type_len,
const char *  sql_text,
size_t  sql_text_len 
)
private

Write a command to traditional general log file.

Log given command to normal (not rotatable) log file.

Parameters
event_utimeCommand start timestamp in micro seconds
thread_idId of the thread that issued the query
command_typeThe type of the command being logged
command_type_lenThe length of the string above
sql_textThe very text of the query being executed
sql_text_lenThe length of sql_text string
Returns
true if error, false otherwise.

◆ write_slow()

bool File_query_log::write_slow ( THD thd,
ulonglong  current_utime,
ulonglong  query_start_utime,
const char *  user_host,
size_t  user_host_len,
ulonglong  query_utime,
ulonglong  lock_utime,
bool  is_command,
const char *  sql_text,
size_t  sql_text_len,
struct System_status_var query_start 
)
private

Log a query to the traditional slow log file.

Parameters
thdTHD of the query
current_utimeCurrent timestamp in microseconds
query_start_utimeCommand start timestamp in microseconds
user_hostThe pointer to the string with user@host info
user_host_lenLength of the user_host string
query_utimeNumber of microseconds query execution took
lock_utimeNumber of microseconds the query was locked
is_commandThe flag which determines whether the sql_text is a query or an administrator command
sql_textThe query or administrator in textual form
sql_text_lenThe length of sql_text string
query_startPointer to a snapshot of thd->status_var taken at the start of execution
Returns
true if error, false otherwise.

Friends And Related Function Documentation

◆ Log_to_file_event_handler

friend class Log_to_file_event_handler
friend

◆ Query_logger

friend class Query_logger
friend

Member Data Documentation

◆ db

char File_query_log::db[NAME_LEN+1]
private

Last seen current database.

◆ LOCK_log

mysql_mutex_t File_query_log::LOCK_log
private

Makes sure we only have one write at a time.

◆ log_file

IO_CACHE File_query_log::log_file
private

◆ log_file_name

char File_query_log::log_file_name[FN_REFLEN]
private

Path to log file.

◆ log_open

volatile bool File_query_log::log_open
private

True if the file log is open, false otherwise.

◆ m_log_file_key

PSI_file_key File_query_log::m_log_file_key
private

Instrumentation key to use for file io in log_file.

◆ m_log_type

const enum_log_table_type File_query_log::m_log_type
private

Type of log file.

◆ name

char* File_query_log::name
private

Log filename.

◆ write_error

bool File_query_log::write_error
private

Have we already printed ER_ERROR_ON_WRITE?


The documentation for this class was generated from the following file: