0

My location is behind 3 hours from the server location and I want to make my log time the same with my local time without changing the my servers' settings?

noobprog
  • 327
  • 1
  • 4
  • 16
  • possible duplicate of [Python logging: How to set time to GMT](http://stackoverflow.com/questions/6321160/python-logging-how-to-set-time-to-gmt) – Selcuk Apr 11 '14 at 15:02

1 Answers1

0

The answer would be

import logging
import time

logging.basicConfig(format='%(asctime)s %(message)s')
logging.warning('server time')

logging.Formatter.converter = lambda self, current: time.localtime(current-3600*3)

logging.warning('time at your zone')

The time.localtime is server time. and then I gave bias -3600*3 (or + is possible).

emesday
  • 6,078
  • 3
  • 29
  • 46