Troubleshooting Python Logging Timedrotatingfilehandler module

Source: Internet
Author: User

My scheduled task will be 5 o'clock in the morning every day to adjust a transaction, trading logs with the logging module, today found that log has a problem, the following troubleshooting.


  1. When viewing the log, I found that I should have logged 5, and the log time was displayed as

    2016-09-12 21:00:02,379-info-novel.py[line:82]-Select day

  2. Checked the code, did not find the problem, and then found 21 points and 5 spreads 8 hours, that is, the log hit UTC time

  3. To search the relevant information on the Internet, a post said he used logging, the use of Timedrotatingfilehandler will put today's log into yesterday's log file, feeling and my problem is very similar, To see the Timedrotatingfilehandler module

  4. View Timedrotatingfilehandler no obvious problem, so simplify the code, want to debug to see where the time has changed

  5. The first run results come out, fuck, the result is correct

  6. Later thought I was in the Windows test, this problem will not only appear in Linux, and then copy the code to Linux, execute, there is a problem.

  7. Compared to the logging module code under Windows and Linux, there are some differences, but no time-related differences

  8. Next, make a Linux environment, install an IDE, go to debug, see where the problem is

Troubleshooting Python Logging Timedrotatingfilehandler module

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.