From 98022dffbb575bf765cc2b4493473f6b8943f281 Mon Sep 17 00:00:00 2001 From: Randall Leeds Date: Mon, 27 Jan 2014 22:54:03 -0800 Subject: [PATCH] Include tz offset in access log Fix #683 --- gunicorn/glogging.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/gunicorn/glogging.py b/gunicorn/glogging.py index 3def196f..2aa35180 100644 --- a/gunicorn/glogging.py +++ b/gunicorn/glogging.py @@ -3,7 +3,7 @@ # This file is part of gunicorn released under the MIT license. # See the NOTICE for more information. -import datetime +import time import logging logging.Logger.manager.emittedNoHandlerWarning = 1 from logging.config import fileConfig @@ -277,10 +277,7 @@ class Logger(object): def now(self): """ return date in Apache Common Log Format """ - now = datetime.datetime.now() - month = util.monthname[now.month] - return '[%02d/%s/%04d:%02d:%02d:%02d]' % (now.day, month, - now.year, now.hour, now.minute, now.second) + return time.strftime('[%d/%b/%Y:%H:%M:%S %z]') def reopen_files(self): for log in loggers():