This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Logging Module - followfile patch
Type: Stage:
Components: Extension Modules Versions: Python 2.5
process
Status: closed Resolution: duplicate
Dependencies: Superseder:
Assigned To: Nosy List: cjschr, georg.brandl
Priority: normal Keywords: patch

Created on 2006-11-17 15:56 by cjschr, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
logging.patch cjschr, 2006-11-17 15:56 logging module followfile patch
Messages (2)
msg51375 - (view) Author: chads (cjschr) Date: 2006-11-17 15:56
Pertaining to the FileHandler and the file being written to:

It's possible that the file being written to will be
rolled-over by an external application such as newsyslog.
By default, FileHandler tracks the file descriptor, 
not the file.  If the original file is renamed, the file 
descriptor is still updated; however, it's probably 
desired that continued updates to the original file take 
place instead.

This patch adds an attribute to the FileHandler class
constructor (and basicConfig kw as well).  If the 
attribute evaluates to True, the filename, not the 
descriptor is tracked.  Basically, the code compares the 
file status from a previous emit call to the current call
before the base class emit is called.  If a difference in
st_ino or st_dev is found, the current stream is 
flush/closed and a new one, based on baseFilename, is
created, file status is updated, and then the base class 
emit is called.
msg51376 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2006-11-17 19:46
Duplicate of #1598415.
History
Date User Action Args
2022-04-11 14:56:21adminsetgithub: 44248
2006-11-17 15:56:56cjschrcreate