sonic-net / sonic-gnmi

SONiC gNMI server and gNOI repo
Other
22 stars 52 forks source link

Add swss-common log level support to GNMI service #330

Closed liuh-80 closed 3 days ago

liuh-80 commented 3 days ago

Add swss-common log level support to GNMI service

Why I did it

Improve GNMI debug experience

How I did it

Initialize swss-common log level thread when GNMI start.

How to verify it

Manually test:

admin@vlab-01:~$ swssloglevel -l NOTICE -c telemetry admin@vlab-01:~$ sudo tail -f /var/log/syslog 2024 Nov 22 05:30:03.876827 vlab-01 DEBUG gnmi#telemetry: :> select: enter 2024 Nov 22 05:30:04.734015 vlab-01 INFO systemd[1]: Starting sysstat-collect.service - system activity accounting tool... 2024 Nov 22 05:30:04.740683 vlab-01 INFO systemd[1]: Starting logrotate.service - Rotate log files... 2024 Nov 22 05:30:04.750069 vlab-01 DEBUG gnmi#telemetry: :< select: exit 2024 Nov 22 05:30:04.754189 vlab-01 DEBUG gnmi#telemetry: :- swssPrioNotify: Changing logger minPrio to NOTICE

Add new UT.

Work item tracking

Microsoft ADO (number only): 30298614

Which release branch to backport (provide reason below if selected)

Description for the changelog

Add swss-common log level support to GNMI service

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)