diff options
author | Christian Poessinger <christian@poessinger.com> | 2022-01-11 08:22:14 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-11 08:22:14 +0100 |
commit | c0d65731d904832eb8709e32950d3fdbc89c9b5b (patch) | |
tree | 4955ad79b36bc55032d1587a133cf0b4a780c4e6 | |
parent | 1a33b2f6db4781d3c48f5ddc62da530807e784c8 (diff) | |
parent | cb797395a4df6b0b7a192e9e1f25427f921fac06 (diff) | |
download | vyos-1x-c0d65731d904832eb8709e32950d3fdbc89c9b5b.tar.gz vyos-1x-c0d65731d904832eb8709e32950d3fdbc89c9b5b.zip |
Merge pull request #1153 from jestabro/frr_debug
frr: T4166: move log debug setting to init function for vyos-configd
-rw-r--r-- | python/vyos/frr.py | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/python/vyos/frr.py b/python/vyos/frr.py index a8f115d9a..cbba19ab7 100644 --- a/python/vyos/frr.py +++ b/python/vyos/frr.py @@ -73,15 +73,15 @@ from vyos.util import cmd import logging from logging.handlers import SysLogHandler import os +import sys + LOG = logging.getLogger(__name__) +DEBUG = False -DEBUG = os.path.exists('/tmp/vyos.frr.debug') -if DEBUG: - LOG.setLevel(logging.DEBUG) - ch = SysLogHandler(address='/dev/log') - ch2 = logging.StreamHandler() - LOG.addHandler(ch) - LOG.addHandler(ch2) +ch = SysLogHandler(address='/dev/log') +ch2 = logging.StreamHandler(stream=sys.stdout) +LOG.addHandler(ch) +LOG.addHandler(ch2) _frr_daemons = ['zebra', 'bgpd', 'fabricd', 'isisd', 'ospf6d', 'ospfd', 'pbrd', 'pimd', 'ripd', 'ripngd', 'sharpd', 'staticd', 'vrrpd', 'ldpd', @@ -121,6 +121,12 @@ class ConfigSectionNotFound(FrrError): """ pass +def init_debugging(): + global DEBUG + + DEBUG = os.path.exists('/tmp/vyos.frr.debug') + if DEBUG: + LOG.setLevel(logging.DEBUG) def get_configuration(daemon=None, marked=False): """ Get current running FRR configuration @@ -424,6 +430,8 @@ class FRRConfig: Using this overwrites the current loaded config objects and replaces the original loaded config ''' + init_debugging() + self.imported_config = get_configuration(daemon=daemon) if daemon: LOG.debug(f'load_configuration: Configuration loaded from FRR daemon {daemon}') |