summaryrefslogtreecommitdiffstats
path: root/Lib/logging
diff options
context:
space:
mode:
authorVinay Sajip <vinay_sajip@yahoo.co.uk>2010-07-15 21:40:13 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2010-07-15 21:40:13 (GMT)
commite030d937c61006df02caaae8ad1e540b15c88a58 (patch)
treed2198df8f8328992a76de03f809df114df1a429e /Lib/logging
parent09cfa890d2258e4b969fd338293a068f48e899d4 (diff)
downloadcpython-e030d937c61006df02caaae8ad1e540b15c88a58.zip
cpython-e030d937c61006df02caaae8ad1e540b15c88a58.tar.gz
cpython-e030d937c61006df02caaae8ad1e540b15c88a58.tar.bz2
Backported SysLogHandler fix for issue #7077.
Diffstat (limited to 'Lib/logging')
-rw-r--r--Lib/logging/handlers.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/Lib/logging/handlers.py b/Lib/logging/handlers.py
index 31352ad..82c418b 100644
--- a/Lib/logging/handlers.py
+++ b/Lib/logging/handlers.py
@@ -202,7 +202,11 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
self.extMatch = re.compile(self.extMatch, re.ASCII)
self.interval = self.interval * interval # multiply by units requested
- self.rolloverAt = self.computeRollover(int(time.time()))
+ if os.path.exists(filename):
+ t = os.stat(filename)[ST_MTIME]
+ else:
+ t = int(time.time())
+ self.rolloverAt = self.computeRollover(t)
def computeRollover(self, currentTime):
"""
@@ -774,6 +778,9 @@ class SysLogHandler(logging.Handler):
self.encodePriority(self.facility,
self.mapPriority(record.levelname)),
msg)
+ msg = msg.encode('utf-8')
+ if codecs:
+ msg = codecs.BOM_UTF8 + msg
try:
if self.unixsocket:
try: