Skip to content
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

Set swsscommon logging level #178

Merged
merged 2 commits into from
Nov 25, 2020
Merged

Conversation

qiluo-msft
Copy link
Contributor

@qiluo-msft qiluo-msft commented Nov 21, 2020

Depends on sonic-net/sonic-swss-common#418
There are many warning messages in swsscommon. Here I set the log_level higher to ERROR, so warnings will disappear in syslog.

Fixed sonic-net/sonic-buildimage#5992

@@ -75,6 +76,10 @@ def install_fragments():
sonic_ax_impl.logger.setLevel(log_level)
ax_interface.logger.setLevel(log_level)
swsssdk.logger.setLevel(log_level_sdk)
# Note: swsscommon uses a fixed log level for simplicity
# TODO: improve it when log_level option is used
log_level_swsscommon = swsscommon.Logger.SWSS_ERROR
Copy link
Contributor

@SuvarnaMeenakshi SuvarnaMeenakshi Nov 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can this be modified as below:
if args.get('log_level') is not None and args.get('log_level') == logging.INFO:
log_level_swsscommon = swsscommon.Logger.SWSS_INFO
if args.get('log_level') is not None and args.get('log_level') == logging.ERROR:
log_level_swsscommon = swsscommon.Logger.SWSS_ERROR
else:
log_level_swsscommon = swsscommon.Logger.SWSS_ERROR #Resolved

Copy link

@vaibhavhd vaibhavhd Nov 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think if args.get('log_level') is not None is not needed and we can directly check the value of args.get('log_level')

Qi, what are we achieving with this change (in order to fix sonic-net/sonic-buildimage#5992). Will the warnings start appearing as errors? #Resolved

Copy link

@vaibhavhd vaibhavhd Nov 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the description of the PR be modified with some context? #Resolved

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warnings in swsscommon will still be warnings. Here I set the log_level higher to ERROR, so warning will disappear in syslog.


In reply to: 529841456 [](ancestors = 529841456)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated.


In reply to: 529842115 [](ancestors = 529842115)

Copy link

@vaibhavhd vaibhavhd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@qiluo-msft qiluo-msft merged commit fd1eae7 into sonic-net:master Nov 25, 2020
@qiluo-msft qiluo-msft deleted the qiluo/swiglog branch November 25, 2020 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Python WARNINGs for empty APPL_DB appear on syslog
3 participants