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
d345bb4d
Kaydet (Commit)
d345bb4d
authored
Eyl 25, 2018
tarafından
Cheryl Sabella
Kaydeden (comit)
Vinay Sajip
Eyl 25, 2018
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
bpo-34334: Don't log traceback twice in QueueHandler (GH-9537)
üst
fad6af27
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
5 deletions
+23
-5
logging.handlers.rst
Doc/library/logging.handlers.rst
+3
-3
handlers.py
Lib/logging/handlers.py
+3
-2
test_logging.py
Lib/test/test_logging.py
+15
-0
2018-09-25-08-42-34.bpo-34334.rSPBW9.rst
...S.d/next/Library/2018-09-25-08-42-34.bpo-34334.rSPBW9.rst
+2
-0
No files found.
Doc/library/logging.handlers.rst
Dosyayı görüntüle @
d345bb4d
...
...
@@ -973,9 +973,9 @@ possible, while any potentially slow operations (such as sending an email via
Prepares a record for queuing. The object returned by this
method is enqueued.
The base implementation formats the record to merge the message
a
nd arguments, and removes unpickleable items from the record
in-place.
The base implementation formats the record to merge the message
,
a
rguments, and exception information, if present. It also
removes unpickleable items from the record
in-place.
You might want to override this method if you want to convert
the record to a dict or JSON string, or send a modified copy
...
...
Lib/logging/handlers.py
Dosyayı görüntüle @
d345bb4d
...
...
@@ -1374,13 +1374,14 @@ class QueueHandler(logging.Handler):
# (if there's exception data), and also returns the formatted
# message. We can then use this to replace the original
# msg + args, as these might be unpickleable. We also zap the
# exc_info a
ttribute, as it's no longer needed and, if not None,
# will typically not be pickleable.
# exc_info a
nd exc_text attributes, as they are no longer
#
needed and, if not None,
will typically not be pickleable.
msg
=
self
.
format
(
record
)
record
.
message
=
msg
record
.
msg
=
msg
record
.
args
=
None
record
.
exc_info
=
None
record
.
exc_text
=
None
return
record
def
emit
(
self
,
record
):
...
...
Lib/test/test_logging.py
Dosyayı görüntüle @
d345bb4d
...
...
@@ -3345,6 +3345,21 @@ class QueueHandlerTest(BaseTest):
self
.
assertFalse
(
handler
.
matches
(
levelno
=
logging
.
WARNING
,
message
=
'4'
))
self
.
assertFalse
(
handler
.
matches
(
levelno
=
logging
.
ERROR
,
message
=
'5'
))
self
.
assertTrue
(
handler
.
matches
(
levelno
=
logging
.
CRITICAL
,
message
=
'6'
))
handler
.
close
()
@unittest.skipUnless
(
hasattr
(
logging
.
handlers
,
'QueueListener'
),
'logging.handlers.QueueListener required for this test'
)
def
test_queue_listener_with_StreamHandler
(
self
):
# Test that traceback only appends once (bpo-34334).
listener
=
logging
.
handlers
.
QueueListener
(
self
.
queue
,
self
.
root_hdlr
)
listener
.
start
()
try
:
1
/
0
except
ZeroDivisionError
as
e
:
exc
=
e
self
.
que_logger
.
exception
(
self
.
next_message
(),
exc_info
=
exc
)
listener
.
stop
()
self
.
assertEqual
(
self
.
stream
.
getvalue
()
.
strip
()
.
count
(
'Traceback'
),
1
)
if
hasattr
(
logging
.
handlers
,
'QueueListener'
):
import
multiprocessing
...
...
Misc/NEWS.d/next/Library/2018-09-25-08-42-34.bpo-34334.rSPBW9.rst
0 → 100644
Dosyayı görüntüle @
d345bb4d
In :class:`QueueHandler`, clear `exc_text` from :class:`LogRecord` to
prevent traceback from being written twice.
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