From 2bfcf67eab80f06cdf539a04865a6a8caaef58e7 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Tue, 2 Oct 2018 21:34:10 +0200 Subject: [PATCH] nicer logs --- sfa/trust/certificate.py | 4 ++-- sfa/trust/gid.py | 4 +++- sfa/util/sfalogging.py | 6 +++--- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/sfa/trust/certificate.py b/sfa/trust/certificate.py index 199504dc..dfee4e8d 100644 --- a/sfa/trust/certificate.py +++ b/sfa/trust/certificate.py @@ -838,7 +838,6 @@ class Certificate: # the public key contained in it's parent. The chain is recursed # until a certificate is found that is signed by a trusted root. - logger.debug("Certificate.verify_chain {}".format(self.pretty_name())) # verify expiration time if self.x509.has_expired(): if debug_verify_chain: @@ -848,7 +847,8 @@ class Certificate: # if this cert is signed by a trusted_cert, then we are set for i, trusted_cert in enumerate(trusted_certs, 1): - logger.debug("Certificate.verify_chain - trying trusted #{} : {}" + logger.debug(5*'-' + + " Certificate.verify_chain - trying trusted #{} : {}" .format(i, trusted_cert.pretty_name())) if self.is_signed_by_cert(trusted_cert): # verify expiration of trusted_cert ? diff --git a/sfa/trust/gid.py b/sfa/trust/gid.py index 7222b181..799b1f47 100644 --- a/sfa/trust/gid.py +++ b/sfa/trust/gid.py @@ -232,7 +232,9 @@ class GID(Certificate): # planetlab.us.arizona cannot sign a GID for planetlab.us.princeton.foo. def verify_chain(self, trusted_certs=None): - logger.debug("GID.verify_chain with {} trusted certs".format(len(trusted_certs))) + logger.debug(10*'=' + " GID.verify_chain with {} trusted certs" + .format(len(trusted_certs))) + logger.debug("on {}".format(self.pretty_name())) # do the normal certificate verification stuff trusted_root = Certificate.verify_chain(self, trusted_certs) diff --git a/sfa/util/sfalogging.py b/sfa/util/sfalogging.py index 5a9745cf..80d8b3f7 100644 --- a/sfa/util/sfalogging.py +++ b/sfa/util/sfalogging.py @@ -123,7 +123,7 @@ def logging_config(context): if context == 'server': handlername = 'file' filename = '/var/log/sfa.log' - level = 'INFO' + level = 'DEBUG' elif context == 'import': handlername = 'file' filename = '/var/log/sfa-import.log' @@ -168,7 +168,7 @@ def logging_config(context): 'level': level, 'formatter': 'standard', 'class': 'logging.StreamHandler', - } + } else: config['handlers']['file'] = { 'filename': filename, @@ -179,7 +179,7 @@ def logging_config(context): 'when': 'w0', 'interval': 1, 'backupCount': 12, - } + } return config -- 2.43.0