diff options
author | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2009-01-21 00:19:28 (GMT) |
---|---|---|
committer | Vinay Sajip <vinay_sajip@yahoo.co.uk> | 2009-01-21 00:19:28 (GMT) |
commit | 6268cbc77190cf6b4112a272f2870d5361903605 (patch) | |
tree | 3df927837dabe232be5d6264e96fd0036412c04f /Lib/logging/__init__.py | |
parent | b14043c1ec5e8eb25e2e728be64621458891eab3 (diff) | |
download | cpython-6268cbc77190cf6b4112a272f2870d5361903605.zip cpython-6268cbc77190cf6b4112a272f2870d5361903605.tar.gz cpython-6268cbc77190cf6b4112a272f2870d5361903605.tar.bz2 |
Issue 5013: Fixed bug in FileHandler when delay was set - added fix for RotatingFileHandler and changed header comment slightly.
Diffstat (limited to 'Lib/logging/__init__.py')
-rw-r--r-- | Lib/logging/__init__.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Lib/logging/__init__.py b/Lib/logging/__init__.py index ee43554..6296641 100644 --- a/Lib/logging/__init__.py +++ b/Lib/logging/__init__.py @@ -18,7 +18,7 @@ Logging package for Python. Based on PEP 282 and comments thereto in comp.lang.python, and influenced by Apache's log4j system. -Copyright (C) 2001-2008 Vinay Sajip. All Rights Reserved. +Copyright (C) 2001-2009 Vinay Sajip. All Rights Reserved. To use, simply 'import logging' and log away! """ @@ -43,8 +43,8 @@ except ImportError: __author__ = "Vinay Sajip <vinay_sajip@red-dove.com>" __status__ = "production" -__version__ = "0.5.0.6" -__date__ = "03 December 2008" +__version__ = "0.5.0.7" +__date__ = "20 January 2009" #--------------------------------------------------------------------------- # Miscellaneous module data @@ -737,7 +737,6 @@ class StreamHandler(Handler): if strm is None: strm = sys.stderr self.stream = strm - self.formatter = None def flush(self): """ @@ -792,10 +791,12 @@ class FileHandler(StreamHandler): self.mode = mode self.encoding = encoding if delay: + #We don't open the stream, but we still need to call the + #Handler constructor to set level, formatter, lock etc. + Handler.__init__(self) self.stream = None else: - stream = self._open() - StreamHandler.__init__(self, stream) + StreamHandler.__init__(self, self._open()) def close(self): """ @@ -827,8 +828,7 @@ class FileHandler(StreamHandler): constructor, open it before calling the superclass's emit. """ if self.stream is None: - stream = self._open() - StreamHandler.__init__(self, stream) + self.stream = self._open() StreamHandler.emit(self, record) #--------------------------------------------------------------------------- |