Print thread_id instead of pthread_self to error log
- Now we have same thread_id in general log, slow long and error log instead of a long meaningless thread number that may even change for one user. - Align error and slow log header with output - Extend thread_id with one number to handle nice printing up to ten million connections
This commit is contained in:
parent
af06683b73
commit
a70f7aad55
@ -2672,7 +2672,7 @@ bool MYSQL_LOG::open(
|
|||||||
mysqld_port, mysqld_unix_port
|
mysqld_port, mysqld_unix_port
|
||||||
#endif
|
#endif
|
||||||
);
|
);
|
||||||
end= strnmov(buff + len, "Time Id Command Argument\n",
|
end= strnmov(buff + len, "Time\t\t Id Command\tArgument\n",
|
||||||
sizeof(buff) - len);
|
sizeof(buff) - len);
|
||||||
if (my_b_write(&log_file, (uchar*) buff, (uint) (end-buff)) ||
|
if (my_b_write(&log_file, (uchar*) buff, (uint) (end-buff)) ||
|
||||||
flush_io_cache(&log_file))
|
flush_io_cache(&log_file))
|
||||||
@ -2907,7 +2907,7 @@ bool MYSQL_QUERY_LOG::write(time_t event_time, const char *user_host,
|
|||||||
goto err;
|
goto err;
|
||||||
|
|
||||||
/* command_type, thread_id */
|
/* command_type, thread_id */
|
||||||
size_t length= my_snprintf(buff, 32, "%5llu ", thread_id_arg);
|
size_t length= my_snprintf(buff, 32, "%6llu ", thread_id_arg);
|
||||||
|
|
||||||
if (my_b_write(&log_file, (uchar*) buff, length))
|
if (my_b_write(&log_file, (uchar*) buff, length))
|
||||||
goto err;
|
goto err;
|
||||||
@ -8460,7 +8460,7 @@ static void print_buffer_to_file(enum loglevel level, const char *buffer,
|
|||||||
time_t skr;
|
time_t skr;
|
||||||
struct tm tm_tmp;
|
struct tm tm_tmp;
|
||||||
struct tm *start;
|
struct tm *start;
|
||||||
THD *thd;
|
THD *thd= 0;
|
||||||
int tag_length= 0;
|
int tag_length= 0;
|
||||||
char tag[NAME_LEN];
|
char tag[NAME_LEN];
|
||||||
DBUG_ENTER("print_buffer_to_file");
|
DBUG_ENTER("print_buffer_to_file");
|
||||||
@ -8494,7 +8494,7 @@ static void print_buffer_to_file(enum loglevel level, const char *buffer,
|
|||||||
start->tm_hour,
|
start->tm_hour,
|
||||||
start->tm_min,
|
start->tm_min,
|
||||||
start->tm_sec,
|
start->tm_sec,
|
||||||
(unsigned long) pthread_self(),
|
(unsigned long) (thd ? thd->thread_id : 0),
|
||||||
(level == ERROR_LEVEL ? "ERROR" : level == WARNING_LEVEL ?
|
(level == ERROR_LEVEL ? "ERROR" : level == WARNING_LEVEL ?
|
||||||
"Warning" : "Note"),
|
"Warning" : "Note"),
|
||||||
tag_length, tag,
|
tag_length, tag,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user