Skip to main content

mixins for tornado

Project description

cotimelog, inspired from [ConcurrentLogHandler]( To be honest, it is almost the same code. Just edit to make the log file rotated by time.


pip install cotimelog


This class is a log handler which is a drop-in replacement for the python standard log handler TimedRotatingFileHandler. The TimedRotatingFileHandler will failed to rotate when multiple processes are trying to write into the same file. You will meet this issue when you use uwsgi. This ConcurrentTimeRotatingFileHandler class is mainly developed to fix this issue.


Using ConcurrentTimeRotatingFileHandler

import os
import time
from logging import getLogger, INFO
from cotimelog import ConcurrentTimeRotatingFileHandler

# Use an absolute path to prevent file rotation trouble.
log = getLogger()
logfile = os.path.abspath("mylogfile.log")
# Rotate log after 1 second
rotateHandler = ConcurrentTimeRotatingFileHandler(logfile, mode="a", when="S", backupCount=5)

[ for i in range(10)]
[ for i in range(10, 100)]

Apache License, Version 2.0

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cotimelog-0.2.0.tar.gz (7.6 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page