From: Tony Mack <tmack@cs.princeton.edu>
Date: Thu, 10 Sep 2009 19:10:36 +0000 (+0000)
Subject: created SFA_HTTPD_ACCESS_LOGFILE
X-Git-Tag: sfa-0.9-1~6
X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=a02342eff3221b5e96107e06f92f30727b163817;p=sfa.git

created SFA_HTTPD_ACCESS_LOGFILE
---

diff --git a/sfa/util/sfalogging.py b/sfa/util/sfalogging.py
index e2aaaeeb..d801e6ef 100644
--- a/sfa/util/sfalogging.py
+++ b/sfa/util/sfalogging.py
@@ -3,9 +3,15 @@ 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)
-logfile=logging.FileHandler(SFA_ACCESS_LOGFILE)
+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)