提交 a496e671 编写于 作者: Z zh0 提交者: LINGuanRen

change record and print trace log config parameter

上级 403f881b
......@@ -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 {
......
......@@ -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();
}
......
......@@ -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. "
......
......@@ -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 {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册