From: Anil-Kumar Vengalil <Anil-Kumar.Vengalil@sophia.inria.fr> Date: Wed, 28 Oct 2009 16:55:55 +0000 (+0000) Subject: reverting to the old code as the latest modification was making same entries multiple... X-Git-Tag: sfa-0.9-6~92 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=cf993861248041eedd3eabe015b47dcb6a9840a9;p=sfa.git reverting to the old code as the latest modification was making same entries multiple times in the log file --- diff --git a/sfa/util/sfalogging.py b/sfa/util/sfalogging.py index c5fd1c72..ff08c082 100644 --- a/sfa/util/sfalogging.py +++ b/sfa/util/sfalogging.py @@ -2,19 +2,18 @@ import logging #SFA access log initialization +SFA_ACCESS_LOGFILE='/var/log/sfa_access.log' +SFA_HTTPD_ACCESS_LOGFILE='/tmp/sfa_httpd_access.log' +logger=logging.getLogger() +logger.setLevel(logging.INFO) +try: + logfile=logging.FileHandler(SFA_ACCESS_LOGFILE) +except IOError: + # This is usually a permissions error becaue the file is + # owned by root, but httpd is trying to access it. + logfile=logging.FileHandler(SFA_HTTPD_ACCESS_LOGFILE) +formatter = logging.Formatter("%(asctime)s - %(message)s") +logfile.setFormatter(formatter) +logger.addHandler(logfile) def get_sfa_logger(): - - SFA_ACCESS_LOGFILE='/var/log/sfa_access.log' - SFA_HTTPD_ACCESS_LOGFILE='/tmp/sfa_httpd_access.log' - logger=logging.getLogger() - logger.setLevel(logging.INFO) - try: - logfile=logging.FileHandler(SFA_ACCESS_LOGFILE) - except IOError: - # This is usually a permissions error becaue the file is - # owned by root, but httpd is trying to access it. - logfile=logging.FileHandler(SFA_HTTPD_ACCESS_LOGFILE) - formatter = logging.Formatter("%(asctime)s - %(message)s") - logfile.setFormatter(formatter) - logger.addHandler(logfile) return logger