X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Futil%2Fsfalogging.py;h=361a2434b6ef591fb1d07ca512eb672df2b6fdec;hb=88f19e31deca1dc8127f64908cdaa350fd6672fe;hp=61d76a63ff3712d3b0aa05000f9338c66784e1c2;hpb=78cfac29ad0d139fd2a909375bb2ea7d46c305ee;p=sfa.git diff --git a/sfa/util/sfalogging.py b/sfa/util/sfalogging.py index 61d76a63..361a2434 100644 --- a/sfa/util/sfalogging.py +++ b/sfa/util/sfalogging.py @@ -48,9 +48,15 @@ class _SfaLogger: try: handler=logging.handlers.RotatingFileHandler(logfile,maxBytes=1000000, backupCount=5) except IOError: - # This is usually a permissions error becaue the file is + # This is usually a permissions error because the file is # owned by root, but httpd is trying to access it. - tmplogfile=os.getenv("TMPDIR", "/tmp") + os.path.sep + os.path.basename(logfile) + tmplogfile=os.path.join(os.getenv("TMPDIR", os.getenv("TMP", os.path.normpath("/tmp"))), os.path.basename(logfile)) + tmplogfile = os.path.normpath(tmplogfile) + + tmpdir = os.path.dirname(tmplogfile) + if tmpdir and tmpdir != "" and not os.path.exists(tmpdir): + os.makedirs(tmpdir) + # In strange uses, 2 users on same machine might use same code, # meaning they would clobber each others files # We could (a) rename the tmplogfile, or (b)