From da20fde46939645fbc2a947ee9f65c45413eb4cf Mon Sep 17 00:00:00 2001 From: Zhidong Peng Date: Thu, 3 Jul 2025 10:08:59 -0700 Subject: [PATCH] write to system log for connection logger --- proxy_agent/src/proxy/proxy_connection.rs | 6 ++++++ proxy_agent_shared/src/logger/logger_manager.rs | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/proxy_agent/src/proxy/proxy_connection.rs b/proxy_agent/src/proxy/proxy_connection.rs index 806057cf..b4200251 100644 --- a/proxy_agent/src/proxy/proxy_connection.rs +++ b/proxy_agent/src/proxy/proxy_connection.rs @@ -291,6 +291,12 @@ impl ConnectionLogger { "{}[{}] - {}", self.http_connection_id, self.tcp_connection_id, message ); + + // write to system log for connection logger explicitly, + // as the connection logger only writes to file when the connection is dropped and, + // connection logger file log does not write to system log implicitly. + logger_manager::write_system_log(logger_level, message.to_string()); + if let Some(log_for_event) = crate::common::config::get_file_log_level_for_events() { if log_for_event >= logger_level { // write to event diff --git a/proxy_agent_shared/src/logger/logger_manager.rs b/proxy_agent_shared/src/logger/logger_manager.rs index dc849050..4ab046b8 100644 --- a/proxy_agent_shared/src/logger/logger_manager.rs +++ b/proxy_agent_shared/src/logger/logger_manager.rs @@ -161,7 +161,7 @@ pub fn write_many(logger_key: Option, messages: Vec) { } } -fn write_system_log(log_level: LoggerLevel, message: String) { +pub fn write_system_log(log_level: LoggerLevel, message: String) { if log_level > get_max_system_logger_level() { return; }