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

"swssloglevel -l SAI_LOG_LEVEL_ERROR -s -c switch" or any SAI API component no longer works in Master branch #366

Closed
gechiang opened this issue Jul 8, 2020 · 4 comments · Fixed by #365
Assignees

Comments

@gechiang
Copy link

gechiang commented Jul 8, 2020

Noticed that there is no way to set the loglevel for SAI anymore in master branch based image.
Tried master.333 as well as master.339 and both are not working…

admin@str-s6000-acs-8:/var/log/swss$ swssloglevel -p
_SAI_API_ACL Unknown log level
_SAI_API_BFD Unknown log level
_SAI_API_BMTOR Unknown log level
_SAI_API_BRIDGE Unknown log level
_SAI_API_BUFFER Unknown log level
_SAI_API_COUNTER Unknown log level
_SAI_API_DEBUG_COUNTER Unknown log level
_SAI_API_DTEL Unknown log level
_SAI_API_FDB Unknown log level
_SAI_API_HASH Unknown log level
_SAI_API_HOSTIF Unknown log level
_SAI_API_IPMC Unknown log level
_SAI_API_IPMC_GROUP Unknown log level
_SAI_API_ISOLATION_GROUP Unknown log level
_SAI_API_L2MC Unknown log level
_SAI_API_L2MC_GROUP Unknown log level
_SAI_API_LAG Unknown log level
_SAI_API_MACSEC Unknown log level
_SAI_API_MCAST_FDB Unknown log level
_SAI_API_MIRROR Unknown log level
_SAI_API_MPLS Unknown log level
_SAI_API_NAT Unknown log level
_SAI_API_NEIGHBOR Unknown log level
_SAI_API_NEXT_HOP Unknown log level
_SAI_API_NEXT_HOP_GROUP Unknown log level
_SAI_API_POLICER Unknown log level
_SAI_API_PORT Unknown log level
_SAI_API_QOS_MAP Unknown log level
_SAI_API_QUEUE Unknown log level
_SAI_API_ROUTE Unknown log level
_SAI_API_ROUTER_INTERFACE Unknown log level
_SAI_API_RPF_GROUP Unknown log level
_SAI_API_SAMPLEPACKET Unknown log level
_SAI_API_SCHEDULER Unknown log level
_SAI_API_SCHEDULER_GROUP Unknown log level
_SAI_API_SEGMENTROUTE Unknown log level
_SAI_API_STP Unknown log level
_SAI_API_SWITCH Unknown log level
_SAI_API_SYSTEM_PORT Unknown log level
_SAI_API_TAM Unknown log level
_SAI_API_TUNNEL Unknown log level
_SAI_API_UDF Unknown log level
_SAI_API_VIRTUAL_ROUTER Unknown log level
_SAI_API_VLAN Unknown log level
_SAI_API_WRED Unknown log level
buffermgrd NOTICE
fpmsyncd NOTICE
intfmgrd NOTICE
natmgrd NOTICE
natsyncd NOTICE
nbrmgrd NOTICE
neighsyncd NOTICE
orchagent NOTICE
portmgrd NOTICE
portsyncd NOTICE
syncd NOTICE
teammgrd NOTICE
teamsyncd NOTICE
tlm_teamd NOTICE
vlanmgrd NOTICE
vrfmgrd NOTICE
vxlanmgrd NOTICE
admin@str-s6000-acs-8:/var/log/swss$
admin@str-s6000-acs-8:/var/log/swss$ swssloglevel -l SAI_LOG_LEVEL_ERROR -s -c SWITCH
Component not present in DB

Usage: swssloglevel [OPTIONS]
SONiC logging severity level setting.

Options:
-h print this message
-l loglevel value
-c component name in DB for which loglevel is applied (provided with -l)
-a apply loglevel to all components (provided with -l)
-s apply loglevel for SAI api component (equivalent to adding prefix "SAI_API_" to component)
-p print components registered in DB for which setting can be applied

Examples:
swssloglevel -l NOTICE -c orchagent # set orchagent severity level to NOTICE
swssloglevel -l SAI_LOG_LEVEL_ERROR -s -c SWITCH # set SAI_API_SWITCH severity to ERROR
swssloglevel -l SAI_LOG_LEVEL_DEBUG -s -a # set all SAI_API_* severity to DEBUG
admin@str-s6000-acs-8:/var/log/swss$

admin@str-s6000-acs-8:~$ show vers

SONiC Software Version: SONiC.master.339-31baf381
Distribution: Debian 10.4
Kernel: 4.19.0-6-2-amd64
Build commit: 31baf38
Build date: Tue Jul 7 07:01:13 UTC 2020
Built by: johnar@jenkins-worker-8

Platform: x86_64-dell_s6000_s1220-r0
HwSKU: Force10-S6000
ASIC: broadcom
Serial Number: 1QBRX42
Uptime: 20:32:35 up 1:09, 1 user, load average: 1.12, 1.09, 1.12

@stephenxs
Copy link
Collaborator

I think this should be the consequence of this issue 357
someone inserts the log level entries through ProductionStateTable but nobody tries consuming those entries, leaving the keys of most of the entries prefixed with an underscore and failing the swssloglevel who doesn't try to handle this case.

@gechiang
Copy link
Author

@marian-pritsak Someone told me that Marian implemented this for SAI. Can Marian please comment as what is needed to fix this issue?
Thanks!

@gechiang
Copy link
Author

@shi-su How are we doing on this issue?
I have another issue pending on this to be resolved (sonic-net/sonic-buildimage#4646).
BRCM requires us to set the SAI_API_PORT log level to INFO in order to get more debug information for them to debug the issue. Appreciate if this log level setting issue can be addressed with a higher priority if possible.
Thanks!

@shi-su
Copy link
Contributor

shi-su commented Jul 18, 2020

@gechiang I just submitted a PR for this issue. #365

@lguohan lguohan transferred this issue from sonic-net/sonic-swss Jul 18, 2020
@lguohan lguohan linked a pull request Jul 18, 2020 that will close this issue
lguohan pushed a commit that referenced this issue Jul 22, 2020
- Why I did it
This PR contains the code changes to fix the SAI API log level issue #366

- Why this issue happens
In the initialization of syncd, the main function first calls linkToDbNative function to initialize the log level for syncd. Then the log levels for SAI APIs are initialized using linkToDb. Since the settingThread of logger is set up by linkToDbNative function and the ConsumerStateTables are set up only in the initialization of the thread, the SAI API log levels in only added to m_settingChangeObservers, whereas the corresponding ConsumerStateTables are not created. Therefore, the SAI API log levels are not successfully initialized.

- How I did it
Instead of creating ConsumerStateTables at the initialization of settingThread, I create ConsumerStateTables in the execution loop of the thread. Such a change fixes the issue by allowing to create the corresponding ConsumerStateTables when there are new items added to m_settingChangeObservers.

- How to verify it
Verify all SAI API log levels are correctly initialized and can be modified in vs tests. A unit test is also added to simulate the scenario and verify the log levels can be properly handled.
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 a pull request may close this issue.

3 participants