New submission from Turnaev Evgeny :
i have a very basic setup of logging in a long running daemon app..
I use TimedRotatingFileHandler with rotating at midnight.
The bug:
The last open logging file was for 2009-05-25..
app was running without logging anything for about a week or more.
After a week past something happened and daemon started to log messages,
but.. for each new message logging system creates new file.
In other words.. suppose we was idle since 2009-05-25, now it is
2009-06-10 and we want to log 10 messages..
current opened file is for 2009-05-25.. so when a first messages
arrives into logging system current must be closed. and a new file must
be opened where all 10 messages should be..
but instead logging system will log each subsequent message in files
2009-05-26, 2009-05-27, 2009-05-28..(in fact it will log in file
without a date and then when nect message arives rename current to
2009-05-26, 2009-05-27, 2009-05-28.. but is still the same) and so on,
one message per file.. i think until it reaches current date.
It is a logic error.
my logging setup looks like this:
-
import logging
from logging import debug,warning,info,error,critical
from logging.handlers import TimedRotatingFileHandler
log_path = '/var/log/cherry/smsd_reg'
log_level = logging.DEBUG
basic_log_handler = TimedRotatingFileHandler(log_path + "/
app_log_smsd_reg_server",'midnight',1)
basic_log_handler.setLevel(log_level)
basic_log_formatter = logging.Formatter('%(asctime)s pid: %(process)d,
%(levelname)s %(message)s')
basic_log_handler.setFormatter(basic_log_formatter)
logging.getLogger('').addHandler(basic_log_handler)
logging.getLogger('').setLevel(log_level)
system info:
Python 2.5.1
FreeBSD 6.2-RELEASE-p7 FreeBSD 6.2-RELEASE-p7
--
components: Extension Modules
messages: 89191
nosy: SanityIO
severity: normal
status: open
title: logging midnigh rotation
type: behavior
versions: Python 2.5
___
Python tracker
<http://bugs.python.org/issue6252>
___
___
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com