查看log的时候看到log时间与系统时间相差了八个小时。
调试了一下,可以这样修改:
修改文件 netsvc.py
重写 formatTime 方法 (我把相差时间直接写死了)
class DBFormatter(logging.Formatter):
def format(self, record):
record.pid = os.getpid()
record.dbname = getattr(threading.currentThread(), 'dbname', '?')
return logging.Formatter.format(self, record)
def formatTime(self, record, datefmt=None):
now = datetime.datetime.now()+datetime.timedelta(hours=8)
ct = time.localtime(time.mktime(now.timetuple()))
if datefmt:
s = time.strftime(datefmt, ct)
else:
t = time.strftime("%Y-%m-%d %H:%M:%S", ct)
s = "%s,%03d" % (t, record.msecs)
return s