From a957b570444891f070e27b2636890643ab29ae03 Mon Sep 17 00:00:00 2001 From: ye-qiannan Date: Sat, 6 Dec 2025 12:59:47 +0800 Subject: [PATCH] add log printf --- src/ubsocket/brpc/brpc_context.h | 6 ------ src/ubsocket/brpc/brpc_file_descriptor.h | 1 + src/ubsocket/configure_settings.h | 15 ++++++++++----- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/ubsocket/brpc/brpc_context.h b/src/ubsocket/brpc/brpc_context.h index 3e53a1b..7defac7 100644 --- a/src/ubsocket/brpc/brpc_context.h +++ b/src/ubsocket/brpc/brpc_context.h @@ -181,12 +181,6 @@ class Context : public Brpc::ConfigSettings { return; } - if (GetLogUse()) { - if (RpcAdptSetLogCtx() != UMQ_SUCCESS) { - RPC_ADPT_VLOG_WARN("Log output via printf is disabled; messages will be sent to syslog.\n"); - } - } - SetSocketFdTransMode(SOCKET_FD_TRANS_MODE_UMQ); if (m_stats_enable) { diff --git a/src/ubsocket/brpc/brpc_file_descriptor.h b/src/ubsocket/brpc/brpc_file_descriptor.h index fe7c0b8..0083b1e 100644 --- a/src/ubsocket/brpc/brpc_file_descriptor.h +++ b/src/ubsocket/brpc/brpc_file_descriptor.h @@ -940,6 +940,7 @@ private: } if(!context->IsBonding()){ queue_cfg.dev_info.assign_mode = UMQ_DEV_ASSIGN_MODE_DEV; + queue_cfg.dev_info.dev.eid_idx = GetEidIdx(); } else { // init use bonding dev queue_cfg.dev_info.assign_mode = UMQ_DEV_ASSIGN_MODE_EID; diff --git a/src/ubsocket/configure_settings.h b/src/ubsocket/configure_settings.h index aa82342..afee256 100644 --- a/src/ubsocket/configure_settings.h +++ b/src/ubsocket/configure_settings.h @@ -224,6 +224,16 @@ protected: virtual void LoadEnvVars() { char *env_ptr; + if ((env_ptr = getenv(ENV_LOG_USE_PRINTF)) != NULL) { + uint32_t use_printf = static_cast(atoi(env_ptr)); + m_log_use_printf = use_printf != 0; + if(m_log_use_printf){ + if (RpcAdptSetLogCtx() != UMQ_SUCCESS) { + RPC_ADPT_VLOG_WARN("Log output via printf is disabled; messages will be sent to syslog.\n"); + } + } + } + if((env_ptr = getenv(ENV_VAR_LOG_LEVEL)) != NULL){ ReadEnvVar(env_ptr,m_log_level_str,sizeof(m_log_level_str)); } @@ -284,11 +294,6 @@ protected: m_block_type = BLOCK_SIZE_8K; } } - - if ((env_ptr = getenv(ENV_LOG_USE_PRINTF)) != NULL) { - uint32_t use_printf = static_cast(atoi(env_ptr)); - m_log_use_printf = use_printf != 0; - } } void SetSocketFdTransMode(socket_fd_trans_mode trans_mode) -- Gitee