New submission from Friðrik Már Jónsson <frid...@pyth.net>:

It seems to me that the ``mode`` keyword argument of
``logging.handlers.RotatingFileHandler`` is not respected.

Here is an example of opening a nonexistent file::

    Python 2.7 (r27:82500, Aug  4 2010, 15:10:49)
    [GCC 4.3.2] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import logging.handlers
    >>> handler = logging.handlers.RotatingFileHandler('nonexistent.log',
    ...     mode='a+', maxBytes=1000, backupCount=2)
    >>> handler.mode
    'a'
    >>> handler.stream
    <open file '/home/fridrik/nonexistent.log', mode 'a' at 0x2aefbca796f0>

The docs do not mention any deviations from the behavior I expected
(``handler.stream`` having the mode specified as an argument to
``RotatingFileHandler``); only that "If mode is not specified, 'a' is used."

I've confirmed the same behavior on 2.5.2 and 2.6.2.  This happens regardless
of whether the file is being created or already exists.

----------
components: Library (Lib)
messages: 112821
nosy: fridrik
priority: normal
severity: normal
status: open
title: logging.handlers.RotatingFileHandler - mode argument not respected
type: behavior
versions: Python 2.5, Python 2.6, Python 2.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue9512>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to