From 20f866529a2612e2859d83818336332f0bfc1e11 Mon Sep 17 00:00:00 2001 From: Hua Liu <58683130+liuh-80@users.noreply.github.com> Date: Wed, 22 Nov 2023 13:27:52 +0800 Subject: [PATCH] Enable faulthandler to provide more fault information (#301) Enable faulthandler to provide more fault information. #### Work item tracking Microsoft ADO (number only): 17637258 **- What I did** Enable faulthandler to provide more fault information. **- How I did it** Enable faulthandler when snmp-subagent startup. **- How to verify it** Pass all UT **- Description for the changelog** Enable faulthandler to provide more fault information. --- src/sonic_ax_impl/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/sonic_ax_impl/__init__.py b/src/sonic_ax_impl/__init__.py index bbb05e4bb..3e1ae57a1 100644 --- a/src/sonic_ax_impl/__init__.py +++ b/src/sonic_ax_impl/__init__.py @@ -1,9 +1,13 @@ import json import logging.handlers - +import faulthandler # configure logging logger = logging.getLogger(__name__) logger.setLevel(logging.INFO) logger.addHandler(logging.NullHandler()) +# enable faulthandler to provide more information for debug +# after enable faulthandler, the file 'stderr' will be remembered by faulthandler: +# https://docs.python.org/dev/library/faulthandler.html#issue-with-file-descriptors +faulthandler.enable()