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?
Asked
Active
Viewed 80 times
1 Answers
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