diff --git a/deps/oblib/src/lib/oblog/ob_trace_log.h b/deps/oblib/src/lib/oblog/ob_trace_log.h index 190698f675088efc9ef40b4099c60bd0824d618d..24847e1ed04733093aa3d3a7843c67c96452ea36 100644 --- a/deps/oblib/src/lib/oblog/ob_trace_log.h +++ b/deps/oblib/src/lib/oblog/ob_trace_log.h @@ -51,36 +51,36 @@ printable; \ }) -#define NG_TRACE_EXT_TIMES(times, ...) \ - if (CHECK_TRACE_TIMES(times, 500, NULL)) { \ - NG_TRACE_EXT(__VA_ARGS__); \ +#define NG_TRACE_EXT_TIMES(times, ...) \ + if (oceanbase::lib::is_trace_log_enabled() && CHECK_TRACE_TIMES(times, 500, NULL)) { \ + NG_TRACE_EXT(__VA_ARGS__); \ } -#define NG_TRACE_TIMES(times, ...) \ - if (CHECK_TRACE_TIMES(times, 500, NULL)) { \ - NG_TRACE(__VA_ARGS__); \ +#define NG_TRACE_TIMES(times, ...) \ + if (oceanbase::lib::is_trace_log_enabled() && CHECK_TRACE_TIMES(times, 500, NULL)) { \ + NG_TRACE(__VA_ARGS__); \ } -#define NG_TRACE_TIMES_WITH_TRACE_ID(times, tmp_cur_trace_id, ...) \ - if (CHECK_TRACE_TIMES(times, 500, tmp_cur_trace_id)) { \ - NG_TRACE(__VA_ARGS__); \ +#define NG_TRACE_TIMES_WITH_TRACE_ID(times, tmp_cur_trace_id, ...) \ + if (oceanbase::lib::is_trace_log_enabled() && CHECK_TRACE_TIMES(times, 500, tmp_cur_trace_id)) { \ + NG_TRACE(__VA_ARGS__); \ } // Ordinary print log level, judged according to the current system configuration level -#define PRINT_TRACE(log_buffer) \ - if (OB_TRACE_CONFIG::get_log_level() <= OB_LOGGER.get_log_level()) { \ - if (NULL != log_buffer) { \ - ::oceanbase::common::OB_PRINT("[TRACE]", OB_LOG_LEVEL_DIRECT(TRACE), "[normal]", "TRACE", log_buffer); \ - } \ +#define PRINT_TRACE(log_buffer) \ + if (oceanbase::lib::is_trace_log_enabled() && OB_TRACE_CONFIG::get_log_level() <= OB_LOGGER.get_log_level()) { \ + if (NULL != log_buffer) { \ + ::oceanbase::common::OB_PRINT("[TRACE]", OB_LOG_LEVEL_DIRECT(TRACE), "[normal]", "TRACE", log_buffer); \ + } \ } // For logs that are forced to be printed, you can also judge according to the log level: if it is ERROR level, it will // not print, and other levels will be forced to print -#define FORCE_PRINT_TRACE(log_buffer, HEAD) \ - if (OB_LOGGER.get_log_level() != ObLogger::LogLevel::LOG_ERROR) { \ - if (NULL != log_buffer) { \ - ::oceanbase::common::OB_PRINT("[TRACE]", OB_LOG_LEVEL_DIRECT(TRACE), HEAD, "TRACE", *log_buffer); \ - } \ +#define FORCE_PRINT_TRACE(log_buffer, HEAD) \ + if (oceanbase::lib::is_trace_log_enabled() && OB_LOGGER.get_log_level() != ObLogger::LogLevel::LOG_ERROR) { \ + if (NULL != log_buffer) { \ + ::oceanbase::common::OB_PRINT("[TRACE]", OB_LOG_LEVEL_DIRECT(TRACE), HEAD, "TRACE", *log_buffer); \ + } \ } namespace oceanbase { diff --git a/src/observer/ob_server_reload_config.cpp b/src/observer/ob_server_reload_config.cpp index 8f08bfc3aee711cb1f318718ab5463706b7224bc..47444f51d212994d7b8803836e8c479e5bd564dd 100644 --- a/src/observer/ob_server_reload_config.cpp +++ b/src/observer/ob_server_reload_config.cpp @@ -124,7 +124,7 @@ int ObServerReloadConfig::operator()() } (void)reload_diagnose_info_config(GCONF.enable_perf_event); - (void)reload_trace_log_config(GCONF.enable_sql_audit); + (void)reload_trace_log_config(GCONF.enable_record_trace_log); ObTenantManager::get_instance().reload_config(); } diff --git a/src/share/parameter/ob_parameter_seed.ipp b/src/share/parameter/ob_parameter_seed.ipp index 0e7478ebfd83fae376149aca81cc7acfc0500c8c..17d65b0f1893959c171a0ed1fe77357512925d2c 100644 --- a/src/share/parameter/ob_parameter_seed.ipp +++ b/src/share/parameter/ob_parameter_seed.ipp @@ -111,8 +111,8 @@ DEF_BOOL(enable_one_phase_commit, OB_CLUSTER_PARAMETER, "False", "enable one pha ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE)); DEPRECATED_DEF_BOOL(enable_pg, OB_CLUSTER_PARAMETER, "False", "open partition group", ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE)); -DEF_BOOL(enable_record_trace_log, OB_CLUSTER_PARAMETER, "False", - "specifies whether to always record the trace log. The default value is False.", +DEF_BOOL(enable_record_trace_log, OB_CLUSTER_PARAMETER, "True", + "specifies whether to always record the trace log. The default value is True.", ObParameterAttr(Section::OBSERVER, Source::DEFAULT, EditLevel::DYNAMIC_EFFECTIVE)); DEF_INT(system_trace_level, OB_CLUSTER_PARAMETER, "1", "[0,2]", "system trace log level, 0:none, 1:standard, 2:debug. " diff --git a/src/storage/transaction/ob_trans_ctx.cpp b/src/storage/transaction/ob_trans_ctx.cpp index b049ed630d99277b438e2b2f2771140d5fe98572..f4ce74c96e1995fdc55757f33a811bd4b773aa8c 100644 --- a/src/storage/transaction/ob_trans_ctx.cpp +++ b/src/storage/transaction/ob_trans_ctx.cpp @@ -357,16 +357,16 @@ int ObTransCtx::set_partition_trans_ctx_mgr(ObPartitionTransCtxMgr* partition_mg int ObTransCtx::alloc_audit_rec_and_trace_log_(ObTransService* trans_service, ObTransTraceLog*& trace_log) { int ret = OB_SUCCESS; - // 1. sql_audit is on. If fail to get recod but revert successfully, + // 1. enable_record_trace_log is on. If fail to get recod but revert successfully, // it needs to be allocated dynamically. Return error if fail to revert. - // 2. sql_audit is off. Trace log is not required to be recorded + // 2. enable_record_trace_log is off. Trace log is not required to be recorded bool need_alloc = true; ObTransTraceLog* tmp_tlog = NULL; if (OB_ISNULL(trans_service)) { TRANS_LOG(WARN, "invalid argument", K(trans_service)); ret = OB_INVALID_ARGUMENT; - } else if (!GCONF.enable_sql_audit) { + } else if (!oceanbase::lib::is_trace_log_enabled()) { need_alloc = false; ret = OB_SUCCESS; } else {