From: Tony Mack Date: Fri, 23 Oct 2009 22:40:30 +0000 (+0000) Subject: define these variables in the get_sfa_logger() method X-Git-Tag: sfa-0.9-6~138 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=a06b2b3a8d234c913273b5d97b05cbd9c979e28b;p=sfa.git define these variables in the get_sfa_logger() method --- diff --git a/sfa/util/sfalogging.py b/sfa/util/sfalogging.py index d801e6ef..c5fd1c72 100644 --- a/sfa/util/sfalogging.py +++ b/sfa/util/sfalogging.py @@ -2,19 +2,19 @@ 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