-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the issue of no INFO level syslog for caclmgrd #21291
Conversation
Signed-off-by: Zhaohui Sun <zhaohuisun@microsoft.com>
/azp run Azure.sonic-buildimage |
Azure Pipelines successfully started running 1 pipeline(s). |
@Junchao-Mellanox
|
@Junchao-Mellanox @xincunli-sonic could you please help review? |
Hi @ZhaohuiS , changing the default log level will affect many other daemons. I am not sure it is what we want. I suppose there are a few options:
|
|
Hi, I am ok with your first option. For the second one:
SONiC python logger default level is NOTICE since day 0, so, changing it will affect many other daemon, such as xcvrd, thermalctld, etc. |
@Junchao-Mellanox |
Please check this line:
|
Signed-off-by: Zhaohui Sun <zhaohuisun@microsoft.com>
@Junchao-Mellanox @xincunli-sonic could you please review it again? |
/azp run Azure.sonic-buildimage |
Azure Pipelines successfully started running 1 pipeline(s). |
Signed-off-by: Zhaohui Sun <zhaohuisun@microsoft.com>
/azp run Azure.sonic-buildimage |
Azure Pipelines successfully started running 1 pipeline(s). |
@xincunli-sonic Can you help review this change? |
caclmgr.set_min_log_priority_info() it sets min log priority to info, this function is in Logger class, SysLogger doesn't have this function. But DaemonBase still inherits Logger which implements set_min_log_priority_info, that's why even caclmgrd called this function, it didn't throw exception. But it didn't make INFO level effect in SysLogger which is actually used in caclmgrd Even change to use Logger by setting use_syslogger=False, it still doesn't work. The current fix is still not valid. It forces to use log function from Logger class, which still doesn't make sense. For addressing no syslog issue for caclmgrd, fix it in the following PR: There is still a problem for DaemonBase to set log level, track it in #21361 |
Why I did it
Fix issue #21290
Work item tracking
30611546
How I did it
After #17171, it added those log functions in
daemon_base.py
, actually, in those function, it didn't set priority, by default, it sets default level toNOTICE
(https://github.com/sonic-net/sonic-buildimage/blame/9588a40abc27911a82aa2f116c17ce06c2cd7093/src/sonic-py-common/sonic_py_common/logger.py#L39), so even inlog_info
, without priority parameter, the default level is stillNOTICE
, the log which is printed withINFO
level can't be printed into syslog.Because both
src/sonic-py-common/sonic_py_common/syslogger.py
andsrc/sonic-py-common/sonic_py_common/logger.py
implement these functions, we don't need to add those functions indaemon_base.py
The solution is remove them.
And by the way, in
caclmgrd
, it callscaclmgr.set_min_log_priority_info()
,caclmgrd
is an instance ofDaemonBase
whose parent class isLogger
,set_min_log_priority_info
both works foruse_syslogger=True
oruse_syslogger=Flase
in daemon_base.py init function.https://github.com/sonic-net/sonic-buildimage/blame/9588a40abc27911a82aa2f116c17ce06c2cd7093/src/sonic-py-common/sonic_py_common/logger.py#L39
How to verify it
Test evidence:
Console output:
Syslog file output:
set
use_syslogger=True
, same test results withuse_syslogger=False
.Which release branch to backport (provide reason below if selected)
Tested branch (Please provide the tested image version)
Description for the changelog
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)