mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Backported SysLogHandler fix for issue #7077.
This commit is contained in:
parent
09cfa890d2
commit
e030d937c6
1 changed files with 8 additions and 1 deletions
|
@ -202,7 +202,11 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
|
||||||
|
|
||||||
self.extMatch = re.compile(self.extMatch, re.ASCII)
|
self.extMatch = re.compile(self.extMatch, re.ASCII)
|
||||||
self.interval = self.interval * interval # multiply by units requested
|
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):
|
def computeRollover(self, currentTime):
|
||||||
"""
|
"""
|
||||||
|
@ -774,6 +778,9 @@ class SysLogHandler(logging.Handler):
|
||||||
self.encodePriority(self.facility,
|
self.encodePriority(self.facility,
|
||||||
self.mapPriority(record.levelname)),
|
self.mapPriority(record.levelname)),
|
||||||
msg)
|
msg)
|
||||||
|
msg = msg.encode('utf-8')
|
||||||
|
if codecs:
|
||||||
|
msg = codecs.BOM_UTF8 + msg
|
||||||
try:
|
try:
|
||||||
if self.unixsocket:
|
if self.unixsocket:
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue