logging - Python log, should the time use UTC time or local time?
代言
代言 2017-06-12 09:26:57
0
2
1048

Actual Phenomenon

  1. I remember reading a blog before, saying that the time in UTC 0 time zone should be used

  2. But there is nothing wrong with using local time?

Related codes

  • A certain section of my log (using local time)

2017-06-02 10:32:37,951 ERROR concurrent_fetch MainProcess DummyThread-1 concurrent_fetch.py 69 worker err: pision by zero Traceback (most recent call last): File "concurrent_fetch.py", line 67, in worker result = 1 / 0 ZeropisionError: pision by zero

Context

  • Product version: Python 2.7

  • Operating system: Linux

  • Local log (write to file), non-distributed, not across machines

代言
代言

reply all (2)
大家讲道理

If you use your own machine, then using local time will definitely be simpler and easier to watch. In fact, even if you collaborate across machines, work in a distributed manner, etc., using local time is not a big problem, as long as you ensure that your local time and The machines you are working on are in the same time zone, so the time difference will not be huge. All machines can check the time throughntpto avoid time confusion

    Peter_Zhu
    • Using local time seems to be more readable, but the characters used in Chinese are relatively long, which naturally takes up more space, especially when there are many records.

    • Using UTC time is more convenient to calculate, but it is not objective in reading, so the size used is naturally smaller.

      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!