Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
affbd871
Kaydet (Commit)
affbd871
authored
Haz 11, 2009
tarafından
Vinay Sajip
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #5262: Fixed bug in next roll over time computation in TimedRotatingFileHandler.
üst
e653a7d6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
16 deletions
+22
-16
handlers.py
Lib/logging/handlers.py
+14
-11
NEWS
Misc/NEWS
+8
-5
No files found.
Lib/logging/handlers.py
Dosyayı görüntüle @
affbd871
...
@@ -172,7 +172,6 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
...
@@ -172,7 +172,6 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
#
#
# Case of the 'when' specifier is not important; lower or upper case
# Case of the 'when' specifier is not important; lower or upper case
# will work.
# will work.
currentTime
=
int
(
time
.
time
())
if
self
.
when
==
'S'
:
if
self
.
when
==
'S'
:
self
.
interval
=
1
# one second
self
.
interval
=
1
# one second
self
.
suffix
=
"
%
Y-
%
m-
%
d_
%
H-
%
M-
%
S"
self
.
suffix
=
"
%
Y-
%
m-
%
d_
%
H-
%
M-
%
S"
...
@@ -203,8 +202,13 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
...
@@ -203,8 +202,13 @@ 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
=
currentTime
+
self
.
interval
self
.
rolloverAt
=
self
.
computeRollover
(
int
(
time
.
time
()))
def
computeRollover
(
self
,
currentTime
):
"""
Work out the rollover time based on the specified time.
"""
result
=
currentTime
+
self
.
interval
# If we are rolling over at midnight or weekly, then the interval is already known.
# If we are rolling over at midnight or weekly, then the interval is already known.
# What we need to figure out is WHEN the next interval is. In other words,
# What we need to figure out is WHEN the next interval is. In other words,
# if you are rolling over at midnight, then your base interval is 1 day,
# if you are rolling over at midnight, then your base interval is 1 day,
...
@@ -214,7 +218,7 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
...
@@ -214,7 +218,7 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
# the rest. Note that this code doesn't care about leap seconds. :)
# the rest. Note that this code doesn't care about leap seconds. :)
if
self
.
when
==
'MIDNIGHT'
or
self
.
when
.
startswith
(
'W'
):
if
self
.
when
==
'MIDNIGHT'
or
self
.
when
.
startswith
(
'W'
):
# This could be done with less code, but I wanted it to be clear
# This could be done with less code, but I wanted it to be clear
if
utc
:
if
self
.
utc
:
t
=
time
.
gmtime
(
currentTime
)
t
=
time
.
gmtime
(
currentTime
)
else
:
else
:
t
=
time
.
localtime
(
currentTime
)
t
=
time
.
localtime
(
currentTime
)
...
@@ -224,7 +228,7 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
...
@@ -224,7 +228,7 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
# r is the number of seconds left between now and midnight
# r is the number of seconds left between now and midnight
r
=
_MIDNIGHT
-
((
currentHour
*
60
+
currentMinute
)
*
60
+
r
=
_MIDNIGHT
-
((
currentHour
*
60
+
currentMinute
)
*
60
+
currentSecond
)
currentSecond
)
self
.
rolloverA
t
=
currentTime
+
r
resul
t
=
currentTime
+
r
# If we are rolling over on a certain day, add in the number of days until
# If we are rolling over on a certain day, add in the number of days until
# the next rollover, but offset by 1 since we just calculated the time
# the next rollover, but offset by 1 since we just calculated the time
# until the next day starts. There are three cases:
# until the next day starts. There are three cases:
...
@@ -240,15 +244,15 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
...
@@ -240,15 +244,15 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
# The calculations described in 2) and 3) above need to have a day added.
# The calculations described in 2) and 3) above need to have a day added.
# This is because the above time calculation takes us to midnight on this
# This is because the above time calculation takes us to midnight on this
# day, i.e. the start of the next day.
# day, i.e. the start of the next day.
if
when
.
startswith
(
'W'
):
if
self
.
when
.
startswith
(
'W'
):
day
=
t
[
6
]
# 0 is Monday
day
=
t
[
6
]
# 0 is Monday
if
day
!=
self
.
dayOfWeek
:
if
day
!=
self
.
dayOfWeek
:
if
day
<
self
.
dayOfWeek
:
if
day
<
self
.
dayOfWeek
:
daysToWait
=
self
.
dayOfWeek
-
day
daysToWait
=
self
.
dayOfWeek
-
day
else
:
else
:
daysToWait
=
6
-
day
+
self
.
dayOfWeek
+
1
daysToWait
=
6
-
day
+
self
.
dayOfWeek
+
1
newRolloverAt
=
self
.
rolloverA
t
+
(
daysToWait
*
(
60
*
60
*
24
))
newRolloverAt
=
resul
t
+
(
daysToWait
*
(
60
*
60
*
24
))
if
not
utc
:
if
not
self
.
utc
:
dstNow
=
t
[
-
1
]
dstNow
=
t
[
-
1
]
dstAtRollover
=
time
.
localtime
(
newRolloverAt
)[
-
1
]
dstAtRollover
=
time
.
localtime
(
newRolloverAt
)[
-
1
]
if
dstNow
!=
dstAtRollover
:
if
dstNow
!=
dstAtRollover
:
...
@@ -256,9 +260,8 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
...
@@ -256,9 +260,8 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
newRolloverAt
=
newRolloverAt
-
3600
newRolloverAt
=
newRolloverAt
-
3600
else
:
# DST bows out before next rollover, so we need to add an hour
else
:
# DST bows out before next rollover, so we need to add an hour
newRolloverAt
=
newRolloverAt
+
3600
newRolloverAt
=
newRolloverAt
+
3600
self
.
rolloverAt
=
newRolloverAt
result
=
newRolloverAt
return
result
#print "Will rollover at %d, %d seconds from now" % (self.rolloverAt, self.rolloverAt - currentTime)
def
shouldRollover
(
self
,
record
):
def
shouldRollover
(
self
,
record
):
"""
"""
...
@@ -327,8 +330,8 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
...
@@ -327,8 +330,8 @@ class TimedRotatingFileHandler(BaseRotatingHandler):
#print "%s -> %s" % (self.baseFilename, dfn)
#print "%s -> %s" % (self.baseFilename, dfn)
self
.
mode
=
'w'
self
.
mode
=
'w'
self
.
stream
=
self
.
_open
()
self
.
stream
=
self
.
_open
()
newRolloverAt
=
self
.
rolloverAt
+
self
.
interval
currentTime
=
int
(
time
.
time
())
currentTime
=
int
(
time
.
time
())
newRolloverAt
=
self
.
computeRollover
(
currentTime
)
while
newRolloverAt
<=
currentTime
:
while
newRolloverAt
<=
currentTime
:
newRolloverAt
=
newRolloverAt
+
self
.
interval
newRolloverAt
=
newRolloverAt
+
self
.
interval
#If DST changes and midnight or weekly rollover, adjust for this.
#If DST changes and midnight or weekly rollover, adjust for this.
...
...
Misc/NEWS
Dosyayı görüntüle @
affbd871
...
@@ -24,6 +24,9 @@ Core and Builtins
...
@@ -24,6 +24,9 @@ Core and Builtins
Library
Library
-------
-------
- Issue #5262: Fixed bug in next rollover time computation in
TimedRotatingFileHandler.
- Issue #6217: The C implementation of io.TextIOWrapper didn't include the
- Issue #6217: The C implementation of io.TextIOWrapper didn't include the
errors property. Additionally, the errors and encoding properties of StringIO
errors property. Additionally, the errors and encoding properties of StringIO
are always None now.
are always None now.
...
@@ -347,7 +350,7 @@ Library
...
@@ -347,7 +350,7 @@ Library
- Issue #5150: IDLE's format menu now has an option to strip trailing
- Issue #5150: IDLE's format menu now has an option to strip trailing
whitespace.
whitespace.
- Issue #5940: distutils.command.build_clib.check_library_list was not doing
- Issue #5940: distutils.command.build_clib.check_library_list was not doing
the right type checkings anymore.
the right type checkings anymore.
- Issue #4875: On win32, ctypes.util.find_library does no longer
- Issue #4875: On win32, ctypes.util.find_library does no longer
...
@@ -783,7 +786,7 @@ Library
...
@@ -783,7 +786,7 @@ Library
- Issue #6048: Now Distutils uses the tarfile module in archive_util.
- Issue #6048: Now Distutils uses the tarfile module in archive_util.
- Issue #6062: In distutils, fixed the package option of build_ext. Feedback
- Issue #6062: In distutils, fixed the package option of build_ext. Feedback
and tests on pywin32 by Tim Golden.
and tests on pywin32 by Tim Golden.
- Issue #6053: Fixed distutils tests on win32. patch by Hirokazu Yamamoto.
- Issue #6053: Fixed distutils tests on win32. patch by Hirokazu Yamamoto.
...
@@ -791,7 +794,7 @@ Library
...
@@ -791,7 +794,7 @@ Library
- Issue #6046: Fixed the library extension when distutils build_ext is used
- Issue #6046: Fixed the library extension when distutils build_ext is used
inplace. Initial patch by Roumen Petrov.
inplace. Initial patch by Roumen Petrov.
- Issue #6041: Now distutils `sdist` and `register` commands use `check` as a
- Issue #6041: Now distutils `sdist` and `register` commands use `check` as a
subcommand.
subcommand.
- Issue #6022: a test file was created in the current working directory by
- Issue #6022: a test file was created in the current working directory by
...
@@ -812,7 +815,7 @@ Library
...
@@ -812,7 +815,7 @@ Library
- Issue #2245: aifc now skips chunk types it doesn't recognize, per spec.
- Issue #2245: aifc now skips chunk types it doesn't recognize, per spec.
- Issue #5874: distutils.tests.test_config_cmd is not locale-sensitive
- Issue #5874: distutils.tests.test_config_cmd is not locale-sensitive
anymore.
anymore.
- Issue #5810: Fixed Distutils test_build_scripts so it uses
- Issue #5810: Fixed Distutils test_build_scripts so it uses
...
@@ -1221,7 +1224,7 @@ Build
...
@@ -1221,7 +1224,7 @@ Build
linker, rather than always exit successfully. Patch by Floris Bruynooghe.
linker, rather than always exit successfully. Patch by Floris Bruynooghe.
- Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
- Issue #4587: Add configure option --with-dbmliborder=db1:db2:... to specify
the order that backends for the dbm extension are checked.
the order that backends for the dbm extension are checked.
- Link the shared python library with $(MODLIBS).
- Link the shared python library with $(MODLIBS).
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment