Skip to content

Commit 2bbd05d

Browse files
wangxinnissampa
authored andcommitted
Filter out unnecessary dataplane logs (sonic-net#21271)
PR sonic-net#21045 for fixing compatibility issues of docker-sonic-mgmt upgrade removed the hook for setting log levels of couple of loggers. The code for setting log level of ansible loggers is no longer needed after previous ansible upgrade a few years ago. However, setting log level for the 'dataplane' logger is still necessary. This change added back the code to set log level for the 'dataplane' logger to avoid unnessary logs when 'ptfadapter' is used in test script. Signed-off-by: Xin Wang <[email protected]> Signed-off-by: Nishanth Sampath Kumar <[email protected]>
1 parent 2729e85 commit 2bbd05d

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

tests/conftest.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,14 @@ def enhance_inventory(request, tbinfo):
349349
logger.error("Failed to set enhanced 'ansible_inventory' to request.config.option")
350350

351351

352+
def pytest_cmdline_main(config):
353+
354+
# Filter out unnecessary logs generated by calling the ptfadapter plugin
355+
dataplane_logger = logging.getLogger("dataplane")
356+
if dataplane_logger:
357+
dataplane_logger.setLevel(logging.ERROR)
358+
359+
352360
def pytest_collection(session):
353361
"""Workaround to reduce messy plugin logs generated during collection only
354362

0 commit comments

Comments
 (0)