From 59815a268b37a9859c31d6add4546f4c6a7ef6aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= <jan.lindstrom@mariadb.com> Date: Fri, 22 May 2015 08:24:59 +0300 Subject: [PATCH] MDEV-7484: Log Time not consistent with InnoDB errors nor with MySQL error log time format --- sql/log.cc | 5 ++-- storage/innobase/buf/buf0dump.cc | 6 +--- storage/innobase/srv/srv0start.cc | 47 +++++++++++++------------------ storage/xtradb/buf/buf0dump.cc | 6 +--- storage/xtradb/srv/srv0start.cc | 47 +++++++++++++------------------ 5 files changed, 45 insertions(+), 66 deletions(-) diff --git a/sql/log.cc b/sql/log.cc index 826a4d174ff..cb182dbb1d5 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -8269,13 +8269,14 @@ static void print_buffer_to_file(enum loglevel level, const char *buffer, localtime_r(&skr, &tm_tmp); start=&tm_tmp; - fprintf(stderr, "%02d%02d%02d %2d:%02d:%02d [%s] %.*s%.*s\n", - start->tm_year % 100, + fprintf(stderr, "%d-%02d-%02d %2d:%02d:%02d %lu [%s] %.*s%.*s\n", + start->tm_year + 1900, start->tm_mon+1, start->tm_mday, start->tm_hour, start->tm_min, start->tm_sec, + (unsigned long) pthread_self(), (level == ERROR_LEVEL ? "ERROR" : level == WARNING_LEVEL ? "Warning" : "Note"), tag_length, tag, diff --git a/storage/innobase/buf/buf0dump.cc b/storage/innobase/buf/buf0dump.cc index 467f817a2d1..dbfd449c0bd 100644 --- a/storage/innobase/buf/buf0dump.cc +++ b/storage/innobase/buf/buf0dump.cc @@ -123,11 +123,7 @@ buf_dump_status( sizeof(export_vars.innodb_buffer_pool_dump_status), fmt, ap); - if (severity == STATUS_NOTICE || severity == STATUS_ERR) { - ut_print_timestamp(stderr); - fprintf(stderr, " InnoDB: %s\n", - export_vars.innodb_buffer_pool_dump_status); - } + ib_logf((ib_log_level_t) severity, export_vars.innodb_buffer_pool_dump_status); va_end(ap); } diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 5d26af7782e..be98ece404c 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -495,7 +495,8 @@ DECLARE_THREAD(io_handler_thread)( segment = *((ulint*) arg); #ifdef UNIV_DEBUG_THREAD_CREATION - fprintf(stderr, "Io handler thread %lu starts, id %lu\n", segment, + ib_logf(IB_LOG_LEVEL_INFO, + "Io handler thread %lu starts, id %lu\n", segment, os_thread_pf(os_thread_get_curr_id())); #endif @@ -1619,53 +1620,45 @@ innobase_start_or_create_for_mysql(void) } #ifdef UNIV_DEBUG - ut_print_timestamp(stderr); - fprintf(stderr, - " InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!\n"); + ib_logf(IB_LOG_LEVEL_INFO, + " InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!"); #endif #ifdef UNIV_IBUF_DEBUG - ut_print_timestamp(stderr); - fprintf(stderr, - " InnoDB: !!!!!!!! UNIV_IBUF_DEBUG switched on !!!!!!!!!\n"); + ib_logf(IB_LOG_LEVEL_INFO, + " InnoDB: !!!!!!!! UNIV_IBUF_DEBUG switched on !!!!!!!!!"); # ifdef UNIV_IBUF_COUNT_DEBUG - ut_print_timestamp(stderr); - fprintf(stderr, + ib_logf(IB_LOG_LEVEL_INFO, " InnoDB: !!!!!!!! UNIV_IBUF_COUNT_DEBUG switched on " - "!!!!!!!!!\n"); - ut_print_timestamp(stderr); - fprintf(stderr, - " InnoDB: Crash recovery will fail with UNIV_IBUF_COUNT_DEBUG\n"); + "!!!!!!!!!"); + ib_logf(IB_LOG_LEVEL_INFO, + " InnoDB: Crash recovery will fail with UNIV_IBUF_COUNT_DEBUG"); # endif #endif #ifdef UNIV_BLOB_DEBUG - fprintf(stderr, + ib_logf(IB_LOG_LEVEL_INFO, "InnoDB: !!!!!!!! UNIV_BLOB_DEBUG switched on !!!!!!!!!\n" - "InnoDB: Server restart may fail with UNIV_BLOB_DEBUG\n"); + "InnoDB: Server restart may fail with UNIV_BLOB_DEBUG"); #endif /* UNIV_BLOB_DEBUG */ #ifdef UNIV_SYNC_DEBUG - ut_print_timestamp(stderr); - fprintf(stderr, - " InnoDB: !!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!\n"); + ib_logf(IB_LOG_LEVEL_INFO, + " InnoDB: !!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!"); #endif #ifdef UNIV_SEARCH_DEBUG - ut_print_timestamp(stderr); - fprintf(stderr, - " InnoDB: !!!!!!!! UNIV_SEARCH_DEBUG switched on !!!!!!!!!\n"); + ib_logf(IB_LOG_LEVEL_INFO, + " InnoDB: !!!!!!!! UNIV_SEARCH_DEBUG switched on !!!!!!!!!"); #endif #ifdef UNIV_LOG_LSN_DEBUG - ut_print_timestamp(stderr); - fprintf(stderr, - " InnoDB: !!!!!!!! UNIV_LOG_LSN_DEBUG switched on !!!!!!!!!\n"); + ib_logf(IB_LOG_LEVEL_INFO, + " InnoDB: !!!!!!!! UNIV_LOG_LSN_DEBUG switched on !!!!!!!!!"); #endif /* UNIV_LOG_LSN_DEBUG */ #ifdef UNIV_MEM_DEBUG - ut_print_timestamp(stderr); - fprintf(stderr, - " InnoDB: !!!!!!!! UNIV_MEM_DEBUG switched on !!!!!!!!!\n"); + ib_logf(IB_LOG_LEVEL_INFO, + " InnoDB: !!!!!!!! UNIV_MEM_DEBUG switched on !!!!!!!!!"); #endif if (srv_use_sys_malloc) { diff --git a/storage/xtradb/buf/buf0dump.cc b/storage/xtradb/buf/buf0dump.cc index 090e8cac63b..16708d3b5c5 100644 --- a/storage/xtradb/buf/buf0dump.cc +++ b/storage/xtradb/buf/buf0dump.cc @@ -123,11 +123,7 @@ buf_dump_status( sizeof(export_vars.innodb_buffer_pool_dump_status), fmt, ap); - if (severity == STATUS_NOTICE || severity == STATUS_ERR) { - ut_print_timestamp(stderr); - fprintf(stderr, " InnoDB: %s\n", - export_vars.innodb_buffer_pool_dump_status); - } + ib_logf((ib_log_level_t) severity, export_vars.innodb_buffer_pool_dump_status); va_end(ap); } diff --git a/storage/xtradb/srv/srv0start.cc b/storage/xtradb/srv/srv0start.cc index a4330d0661f..ef4547ed06f 100644 --- a/storage/xtradb/srv/srv0start.cc +++ b/storage/xtradb/srv/srv0start.cc @@ -522,7 +522,8 @@ DECLARE_THREAD(io_handler_thread)( os_thread_set_priority(srv_io_tids[tid_i], srv_sched_priority_io); #ifdef UNIV_DEBUG_THREAD_CREATION - fprintf(stderr, "Io handler thread %lu starts, id %lu\n", segment, + ib_logf(IB_LOG_LEVEL_INFO, + "Io handler thread %lu starts, id %lu\n", segment, os_thread_pf(os_thread_get_curr_id())); #endif @@ -1698,53 +1699,45 @@ innobase_start_or_create_for_mysql(void) } #ifdef UNIV_DEBUG - ut_print_timestamp(stderr); - fprintf(stderr, - " InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!\n"); + ib_logf(IB_LOG_LEVEL_INFO, + " InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!"); #endif #ifdef UNIV_IBUF_DEBUG - ut_print_timestamp(stderr); - fprintf(stderr, - " InnoDB: !!!!!!!! UNIV_IBUF_DEBUG switched on !!!!!!!!!\n"); + ib_logf(IB_LOG_LEVEL_INFO, + " InnoDB: !!!!!!!! UNIV_IBUF_DEBUG switched on !!!!!!!!!"); # ifdef UNIV_IBUF_COUNT_DEBUG - ut_print_timestamp(stderr); - fprintf(stderr, + ib_logf(IB_LOG_LEVEL_INFO, " InnoDB: !!!!!!!! UNIV_IBUF_COUNT_DEBUG switched on " - "!!!!!!!!!\n"); - ut_print_timestamp(stderr); - fprintf(stderr, - " InnoDB: Crash recovery will fail with UNIV_IBUF_COUNT_DEBUG\n"); + "!!!!!!!!!"); + ib_logf(IB_LOG_LEVEL_INFO, + " InnoDB: Crash recovery will fail with UNIV_IBUF_COUNT_DEBUG"); # endif #endif #ifdef UNIV_BLOB_DEBUG - fprintf(stderr, + ib_logf(IB_LOG_LEVEL_INFO, "InnoDB: !!!!!!!! UNIV_BLOB_DEBUG switched on !!!!!!!!!\n" - "InnoDB: Server restart may fail with UNIV_BLOB_DEBUG\n"); + "InnoDB: Server restart may fail with UNIV_BLOB_DEBUG"); #endif /* UNIV_BLOB_DEBUG */ #ifdef UNIV_SYNC_DEBUG - ut_print_timestamp(stderr); - fprintf(stderr, - " InnoDB: !!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!\n"); + ib_logf(IB_LOG_LEVEL_INFO, + " InnoDB: !!!!!!!! UNIV_SYNC_DEBUG switched on !!!!!!!!!"); #endif #ifdef UNIV_SEARCH_DEBUG - ut_print_timestamp(stderr); - fprintf(stderr, - " InnoDB: !!!!!!!! UNIV_SEARCH_DEBUG switched on !!!!!!!!!\n"); + ib_logf(IB_LOG_LEVEL_INFO, + " InnoDB: !!!!!!!! UNIV_SEARCH_DEBUG switched on !!!!!!!!!"); #endif #ifdef UNIV_LOG_LSN_DEBUG - ut_print_timestamp(stderr); - fprintf(stderr, - " InnoDB: !!!!!!!! UNIV_LOG_LSN_DEBUG switched on !!!!!!!!!\n"); + ib_logf(IB_LOG_LEVEL_INFO, + " InnoDB: !!!!!!!! UNIV_LOG_LSN_DEBUG switched on !!!!!!!!!"); #endif /* UNIV_LOG_LSN_DEBUG */ #ifdef UNIV_MEM_DEBUG - ut_print_timestamp(stderr); - fprintf(stderr, - " InnoDB: !!!!!!!! UNIV_MEM_DEBUG switched on !!!!!!!!!\n"); + ib_logf(IB_LOG_LEVEL_INFO, + " InnoDB: !!!!!!!! UNIV_MEM_DEBUG switched on !!!!!!!!!"); #endif if (srv_use_sys_malloc) { -- 2.30.9