You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can't set log level in DaemonBase
Only NOTICE the default level can be printed into syslog
Steps to reproduce the issue:
script 1:
from sonic_py_common import daemon_base
SYSLOG_IDENTIFIER = "TestSysLogger"
log3 = daemon_base.DaemonBase(SYSLOG_IDENTIFIER, use_syslogger=True)
log3.set_min_log_priority_debug()
log3.log_info("log3: This is a info message")
log3.log_notice("log3: This is a notice message")
log3.log_warning("log3: This is a warning message")
log3.log_debug("log3: This is a debug message")
log3.log_error("log3: This is a error message")
log3.log_info("log3: This is a info message, console", also_print_to_console=True)
log3.log_notice("log3: This is a notice message, console", also_print_to_console=True)
log3.log_warning("log3: This is a warning message,console", also_print_to_console=True)
log3.log_debug("log3: This is a debug message,console", also_print_to_console=True)
log3.log_error("log3: This is a error message,consle", also_print_to_console=True)
console output 1:
log3: This is a info message, console
log3: This is a notice message, console
log3: This is a warning message,console
log3: This is a debug message,console
log3: This is a error message,consle
syslog output 1:
2025 Jan 9 04:28:28.943065 bjw-can-7260-8 NOTICE TestSysLogger[1112399]: log3: This is a notice message
2025 Jan 9 04:28:28.943233 bjw-can-7260-8 WARNING TestSysLogger[1112399]: log3: This is a warning message
2025 Jan 9 04:28:28.943311 bjw-can-7260-8 ERR TestSysLogger[1112399]: log3: This is a error message
2025 Jan 9 04:28:28.943406 bjw-can-7260-8 NOTICE TestSysLogger[1112399]: log3: This is a notice message, console
2025 Jan 9 04:28:28.943475 bjw-can-7260-8 WARNING TestSysLogger[1112399]: log3: This is a warning message,console
2025 Jan 9 04:28:28.943544 bjw-can-7260-8 ERR TestSysLogger[1112399]: log3: This is a error message,consle
No INFO and DEBUG log
script 2:
from sonic_py_common import daemon_base
SYSLOG_IDENTIFIER = "TestSysLogger"
log3 = daemon_base.DaemonBase(SYSLOG_IDENTIFIER, use_syslogger=False)
log3.set_min_log_priority_debug()
log3.log_info("log3: This is a info message")
log3.log_notice("log3: This is a notice message")
log3.log_warning("log3: This is a warning message")
log3.log_debug("log3: This is a debug message")
log3.log_error("log3: This is a error message")
log3.log_info("log3: This is a info message, console", also_print_to_console=True)
log3.log_notice("log3: This is a notice message, console", also_print_to_console=True)
log3.log_warning("log3: This is a warning message,console", also_print_to_console=True)
log3.log_debug("log3: This is a debug message,console", also_print_to_console=True)
log3.log_error("log3: This is a error message,consle", also_print_to_console=True)
console output 2:
log3: This is a notice message, console
log3: This is a warning message,console
log3: This is a error message,consle
syslog output 2:
2025 Jan 9 04:31:20.918889 bjw-can-7260-8 NOTICE TestSysLogger[1114066]: log3: This is a notice message
2025 Jan 9 04:31:20.919058 bjw-can-7260-8 WARNING TestSysLogger[1114066]: log3: This is a warning message
2025 Jan 9 04:31:20.919134 bjw-can-7260-8 ERR TestSysLogger[1114066]: log3: This is a error message
2025 Jan 9 04:31:20.919213 bjw-can-7260-8 NOTICE TestSysLogger[1114066]: log3: This is a notice message, console
2025 Jan 9 04:31:20.919287 bjw-can-7260-8 WARNING TestSysLogger[1114066]: log3: This is a warning message,console
2025 Jan 9 04:31:20.919353 bjw-can-7260-8 ERR TestSysLogger[1114066]: log3: This is a error message,consle
Description
Can't set log level in DaemonBase
Only NOTICE the default level can be printed into syslog
Steps to reproduce the issue:
script 1:
console output 1:
syslog output 1:
No INFO and DEBUG log
script 2:
console output 2:
syslog output 2:
No INFO and DEBUG log
More details in #21291
Describe the results you received:
INFO and DEBUG logs can't be printed into syslog
no way to set level info in deamon_base.py so far, the default level is NOTICE
Describe the results you expected:
We can control log level in daemon_base.py
Output of
show version
:Output of
show techsupport
:Additional information you deem important (e.g. issue happens only occasionally):
The text was updated successfully, but these errors were encountered: