Skip to content

Commit 59815a2

Browse files
author
Jan Lindström
committed
MDEV-7484: Log Time not consistent with InnoDB errors nor with MySQL error log time format
1 parent 84eaf09 commit 59815a2

File tree

5 files changed

+45
-66
lines changed

5 files changed

+45
-66
lines changed

sql/log.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8269,13 +8269,14 @@ static void print_buffer_to_file(enum loglevel level, const char *buffer,
82698269
localtime_r(&skr, &tm_tmp);
82708270
start=&tm_tmp;
82718271

8272-
fprintf(stderr, "%02d%02d%02d %2d:%02d:%02d [%s] %.*s%.*s\n",
8273-
start->tm_year % 100,
8272+
fprintf(stderr, "%d-%02d-%02d %2d:%02d:%02d %lu [%s] %.*s%.*s\n",
8273+
start->tm_year + 1900,
82748274
start->tm_mon+1,
82758275
start->tm_mday,
82768276
start->tm_hour,
82778277
start->tm_min,
82788278
start->tm_sec,
8279+
(unsigned long) pthread_self(),
82798280
(level == ERROR_LEVEL ? "ERROR" : level == WARNING_LEVEL ?
82808281
"Warning" : "Note"),
82818282
tag_length, tag,

storage/innobase/buf/buf0dump.cc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,7 @@ buf_dump_status(
123123
sizeof(export_vars.innodb_buffer_pool_dump_status),
124124
fmt, ap);
125125

126-
if (severity == STATUS_NOTICE || severity == STATUS_ERR) {
127-
ut_print_timestamp(stderr);
128-
fprintf(stderr, " InnoDB: %s\n",
129-
export_vars.innodb_buffer_pool_dump_status);
130-
}
126+
ib_logf((ib_log_level_t) severity, export_vars.innodb_buffer_pool_dump_status);
131127

132128
va_end(ap);
133129
}

storage/innobase/srv/srv0start.cc

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,8 @@ DECLARE_THREAD(io_handler_thread)(
495495
segment = *((ulint*) arg);
496496

497497
#ifdef UNIV_DEBUG_THREAD_CREATION
498-
fprintf(stderr, "Io handler thread %lu starts, id %lu\n", segment,
498+
ib_logf(IB_LOG_LEVEL_INFO,
499+
"Io handler thread %lu starts, id %lu\n", segment,
499500
os_thread_pf(os_thread_get_curr_id()));
500501
#endif
501502

@@ -1619,53 +1620,45 @@ innobase_start_or_create_for_mysql(void)
16191620
}
16201621

16211622
#ifdef UNIV_DEBUG
1622-
ut_print_timestamp(stderr);
1623-
fprintf(stderr,
1624-
" InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!\n");
1623+
ib_logf(IB_LOG_LEVEL_INFO,
1624+
" InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!");
16251625
#endif
16261626

16271627
#ifdef UNIV_IBUF_DEBUG
1628-
ut_print_timestamp(stderr);
1629-
fprintf(stderr,
1630-
" InnoDB: !!!!!!!! UNIV_IBUF_DEBUG switched on !!!!!!!!!\n");
1628+
ib_logf(IB_LOG_LEVEL_INFO,
1629+
" InnoDB: !!!!!!!! UNIV_IBUF_DEBUG switched on !!!!!!!!!");
16311630
# ifdef UNIV_IBUF_COUNT_DEBUG
1632-
ut_print_timestamp(stderr);
1633-
fprintf(stderr,
1631+
ib_logf(IB_LOG_LEVEL_INFO,
16341632
" InnoDB: !!!!!!!! UNIV_IBUF_COUNT_DEBUG switched on "
1635-
"!!!!!!!!!\n");
1636-
ut_print_timestamp(stderr);
1637-
fprintf(stderr,
1638-
" InnoDB: Crash recovery will fail with UNIV_IBUF_COUNT_DEBUG\n");
1633+
"!!!!!!!!!");
1634+
ib_logf(IB_LOG_LEVEL_INFO,
1635+
" InnoDB: Crash recovery will fail with UNIV_IBUF_COUNT_DEBUG");
16391636
# endif
16401637
#endif
16411638

16421639
#ifdef UNIV_BLOB_DEBUG
1643-
fprintf(stderr,
1640+
ib_logf(IB_LOG_LEVEL_INFO,
16441641
"InnoDB: !!!!!!!! UNIV_BLOB_DEBUG switched on !!!!!!!!!\n"
1645-
"InnoDB: Server restart may fail with UNIV_BLOB_DEBUG\n");
1642+
"InnoDB: Server restart may fail with UNIV_BLOB_DEBUG");
16461643
#endif /* UNIV_BLOB_DEBUG */
16471644

16481645
#ifdef UNIV_SYNC_DEBUG
1649-
ut_print_timestamp(stderr);
1650-
fprintf(stderr,
1651-
" InnoDB: !!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!\n");
1646+
ib_logf(IB_LOG_LEVEL_INFO,
1647+
" InnoDB: !!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!");
16521648
#endif
16531649

16541650
#ifdef UNIV_SEARCH_DEBUG
1655-
ut_print_timestamp(stderr);
1656-
fprintf(stderr,
1657-
" InnoDB: !!!!!!!! UNIV_SEARCH_DEBUG switched on !!!!!!!!!\n");
1651+
ib_logf(IB_LOG_LEVEL_INFO,
1652+
" InnoDB: !!!!!!!! UNIV_SEARCH_DEBUG switched on !!!!!!!!!");
16581653
#endif
16591654

16601655
#ifdef UNIV_LOG_LSN_DEBUG
1661-
ut_print_timestamp(stderr);
1662-
fprintf(stderr,
1663-
" InnoDB: !!!!!!!! UNIV_LOG_LSN_DEBUG switched on !!!!!!!!!\n");
1656+
ib_logf(IB_LOG_LEVEL_INFO,
1657+
" InnoDB: !!!!!!!! UNIV_LOG_LSN_DEBUG switched on !!!!!!!!!");
16641658
#endif /* UNIV_LOG_LSN_DEBUG */
16651659
#ifdef UNIV_MEM_DEBUG
1666-
ut_print_timestamp(stderr);
1667-
fprintf(stderr,
1668-
" InnoDB: !!!!!!!! UNIV_MEM_DEBUG switched on !!!!!!!!!\n");
1660+
ib_logf(IB_LOG_LEVEL_INFO,
1661+
" InnoDB: !!!!!!!! UNIV_MEM_DEBUG switched on !!!!!!!!!");
16691662
#endif
16701663

16711664
if (srv_use_sys_malloc) {

storage/xtradb/buf/buf0dump.cc

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,7 @@ buf_dump_status(
123123
sizeof(export_vars.innodb_buffer_pool_dump_status),
124124
fmt, ap);
125125

126-
if (severity == STATUS_NOTICE || severity == STATUS_ERR) {
127-
ut_print_timestamp(stderr);
128-
fprintf(stderr, " InnoDB: %s\n",
129-
export_vars.innodb_buffer_pool_dump_status);
130-
}
126+
ib_logf((ib_log_level_t) severity, export_vars.innodb_buffer_pool_dump_status);
131127

132128
va_end(ap);
133129
}

storage/xtradb/srv/srv0start.cc

Lines changed: 20 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -522,7 +522,8 @@ DECLARE_THREAD(io_handler_thread)(
522522
os_thread_set_priority(srv_io_tids[tid_i], srv_sched_priority_io);
523523

524524
#ifdef UNIV_DEBUG_THREAD_CREATION
525-
fprintf(stderr, "Io handler thread %lu starts, id %lu\n", segment,
525+
ib_logf(IB_LOG_LEVEL_INFO,
526+
"Io handler thread %lu starts, id %lu\n", segment,
526527
os_thread_pf(os_thread_get_curr_id()));
527528
#endif
528529

@@ -1698,53 +1699,45 @@ innobase_start_or_create_for_mysql(void)
16981699
}
16991700

17001701
#ifdef UNIV_DEBUG
1701-
ut_print_timestamp(stderr);
1702-
fprintf(stderr,
1703-
" InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!\n");
1702+
ib_logf(IB_LOG_LEVEL_INFO,
1703+
" InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!");
17041704
#endif
17051705

17061706
#ifdef UNIV_IBUF_DEBUG
1707-
ut_print_timestamp(stderr);
1708-
fprintf(stderr,
1709-
" InnoDB: !!!!!!!! UNIV_IBUF_DEBUG switched on !!!!!!!!!\n");
1707+
ib_logf(IB_LOG_LEVEL_INFO,
1708+
" InnoDB: !!!!!!!! UNIV_IBUF_DEBUG switched on !!!!!!!!!");
17101709
# ifdef UNIV_IBUF_COUNT_DEBUG
1711-
ut_print_timestamp(stderr);
1712-
fprintf(stderr,
1710+
ib_logf(IB_LOG_LEVEL_INFO,
17131711
" InnoDB: !!!!!!!! UNIV_IBUF_COUNT_DEBUG switched on "
1714-
"!!!!!!!!!\n");
1715-
ut_print_timestamp(stderr);
1716-
fprintf(stderr,
1717-
" InnoDB: Crash recovery will fail with UNIV_IBUF_COUNT_DEBUG\n");
1712+
"!!!!!!!!!");
1713+
ib_logf(IB_LOG_LEVEL_INFO,
1714+
" InnoDB: Crash recovery will fail with UNIV_IBUF_COUNT_DEBUG");
17181715
# endif
17191716
#endif
17201717

17211718
#ifdef UNIV_BLOB_DEBUG
1722-
fprintf(stderr,
1719+
ib_logf(IB_LOG_LEVEL_INFO,
17231720
"InnoDB: !!!!!!!! UNIV_BLOB_DEBUG switched on !!!!!!!!!\n"
1724-
"InnoDB: Server restart may fail with UNIV_BLOB_DEBUG\n");
1721+
"InnoDB: Server restart may fail with UNIV_BLOB_DEBUG");
17251722
#endif /* UNIV_BLOB_DEBUG */
17261723

17271724
#ifdef UNIV_SYNC_DEBUG
1728-
ut_print_timestamp(stderr);
1729-
fprintf(stderr,
1730-
" InnoDB: !!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!\n");
1725+
ib_logf(IB_LOG_LEVEL_INFO,
1726+
" InnoDB: !!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!");
17311727
#endif
17321728

17331729
#ifdef UNIV_SEARCH_DEBUG
1734-
ut_print_timestamp(stderr);
1735-
fprintf(stderr,
1736-
" InnoDB: !!!!!!!! UNIV_SEARCH_DEBUG switched on !!!!!!!!!\n");
1730+
ib_logf(IB_LOG_LEVEL_INFO,
1731+
" InnoDB: !!!!!!!! UNIV_SEARCH_DEBUG switched on !!!!!!!!!");
17371732
#endif
17381733

17391734
#ifdef UNIV_LOG_LSN_DEBUG
1740-
ut_print_timestamp(stderr);
1741-
fprintf(stderr,
1742-
" InnoDB: !!!!!!!! UNIV_LOG_LSN_DEBUG switched on !!!!!!!!!\n");
1735+
ib_logf(IB_LOG_LEVEL_INFO,
1736+
" InnoDB: !!!!!!!! UNIV_LOG_LSN_DEBUG switched on !!!!!!!!!");
17431737
#endif /* UNIV_LOG_LSN_DEBUG */
17441738
#ifdef UNIV_MEM_DEBUG
1745-
ut_print_timestamp(stderr);
1746-
fprintf(stderr,
1747-
" InnoDB: !!!!!!!! UNIV_MEM_DEBUG switched on !!!!!!!!!\n");
1739+
ib_logf(IB_LOG_LEVEL_INFO,
1740+
" InnoDB: !!!!!!!! UNIV_MEM_DEBUG switched on !!!!!!!!!");
17481741
#endif
17491742

17501743
if (srv_use_sys_malloc) {

0 commit comments

Comments
 (0)