Bugs item #1553496, was opened at 2006-09-06 16:03
Message generated for change (Comment added) made by vsajip
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1553496&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.5
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: Walker Hale (walkerh)
Assigned to: Vinay Sajip (vsajip)
Summary: logging.handlers.RotatingFileHandler - inconsistent mode

Initial Comment:
RotatingFileHandler does not remember the mode used to
open files. By default it will initially open its file
with 'a', but client code may set this to something
else. After rollover, the mode for the new file changes
to 'w'. The behavior is inconsistent with the interface.

At the very least the docstring for __init__ should
change to show that the mode parameter is not respected
after rollover.

This affects previous versions.


----------------------------------------------------------------------

>Comment By: Vinay Sajip (vsajip)
Date: 2006-09-11 22:31

Message:
Logged In: YES 
user_id=308438

I don't feel that the current behaviour is inconsistent,
because you normally want the current log file to be
appended to, when the program starts. (Of course, you can
override this to specify "w" and start with a new file for
every run.) However, when you rollover, you want the new
file to be truncated, and not have new log messages appended
to existing data. Hence, "a" is used at first, and "w" at
rollover. Remember, the log file before rollover (e.g.
test.log) is renamed to test.log.n, and rolled-over output
goes into test.log. Since the original test.log is now
test.log.n, what does it mean to open test.log with "a"?
Since test.log does not exist, opening with "w" and "a" are
equivalent.

If you spot a flaw in this reasoning, please re-open and
give a more detailed scenario which explains exactly why the
current behaviour is causing you a problem. In particular,
it would help if you could walk me through a scenario which
shows how the system would behave observably differently if
"a" were used instead of "w" at rollover.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1553496&group_id=5470
_______________________________________________
Python-bugs-list mailing list 
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to