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
4dc385b4
Kaydet (Commit)
4dc385b4
authored
Nis 22, 2013
tarafından
Vinay Sajip
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Issue #17795: Reverted backwards-incompatible change in SysLogHandler with Unix domain sockets.
üst
240a2fd4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
6 deletions
+32
-6
handlers.py
Lib/logging/handlers.py
+29
-6
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/logging/handlers.py
Dosyayı görüntüle @
4dc385b4
# Copyright 2001-201
2
by Vinay Sajip. All Rights Reserved.
# Copyright 2001-201
3
by Vinay Sajip. All Rights Reserved.
#
#
# Permission to use, copy, modify, and distribute this software and its
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# documentation for any purpose and without fee is hereby granted,
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
Additional handlers for the logging package for Python. The core package is
Additional handlers for the logging package for Python. The core package is
based on PEP 282 and comments thereto in comp.lang.python.
based on PEP 282 and comments thereto in comp.lang.python.
Copyright (C) 2001-201
2
Vinay Sajip. All Rights Reserved.
Copyright (C) 2001-201
3
Vinay Sajip. All Rights Reserved.
To use, simply 'import logging.handlers' and log away!
To use, simply 'import logging.handlers' and log away!
"""
"""
...
@@ -737,13 +737,17 @@ class SysLogHandler(logging.Handler):
...
@@ -737,13 +737,17 @@ class SysLogHandler(logging.Handler):
}
}
def
__init__
(
self
,
address
=
(
'localhost'
,
SYSLOG_UDP_PORT
),
def
__init__
(
self
,
address
=
(
'localhost'
,
SYSLOG_UDP_PORT
),
facility
=
LOG_USER
,
socktype
=
socket
.
SOCK_DGRAM
):
facility
=
LOG_USER
,
socktype
=
None
):
"""
"""
Initialize a handler.
Initialize a handler.
If address is specified as a string, a UNIX socket is used. To log to a
If address is specified as a string, a UNIX socket is used. To log to a
local syslogd, "SysLogHandler(address="/dev/log")" can be used.
local syslogd, "SysLogHandler(address="/dev/log")" can be used.
If facility is not specified, LOG_USER is used.
If facility is not specified, LOG_USER is used. If socktype is
specified as socket.SOCK_DGRAM or socket.SOCK_STREAM, that specific
socket type will be used. For Unix sockets, you can also specify a
socktype of None, in which case socket.SOCK_DGRAM will be used, falling
back to socket.SOCK_STREAM.
"""
"""
logging
.
Handler
.
__init__
(
self
)
logging
.
Handler
.
__init__
(
self
)
...
@@ -756,18 +760,37 @@ class SysLogHandler(logging.Handler):
...
@@ -756,18 +760,37 @@ class SysLogHandler(logging.Handler):
self
.
_connect_unixsocket
(
address
)
self
.
_connect_unixsocket
(
address
)
else
:
else
:
self
.
unixsocket
=
0
self
.
unixsocket
=
0
if
socktype
is
None
:
socktype
=
socket
.
SOCK_DGRAM
self
.
socket
=
socket
.
socket
(
socket
.
AF_INET
,
socktype
)
self
.
socket
=
socket
.
socket
(
socket
.
AF_INET
,
socktype
)
if
socktype
==
socket
.
SOCK_STREAM
:
if
socktype
==
socket
.
SOCK_STREAM
:
self
.
socket
.
connect
(
address
)
self
.
socket
.
connect
(
address
)
self
.
socktype
=
socktype
self
.
formatter
=
None
self
.
formatter
=
None
def
_connect_unixsocket
(
self
,
address
):
def
_connect_unixsocket
(
self
,
address
):
self
.
socket
=
socket
.
socket
(
socket
.
AF_UNIX
,
self
.
socktype
)
use_socktype
=
self
.
socktype
if
use_socktype
is
None
:
use_socktype
=
socket
.
SOCK_DGRAM
self
.
socket
=
socket
.
socket
(
socket
.
AF_UNIX
,
use_socktype
)
try
:
try
:
self
.
socket
.
connect
(
address
)
self
.
socket
.
connect
(
address
)
# it worked, so set self.socktype to the used type
self
.
socktype
=
use_socktype
except
socket
.
error
:
except
socket
.
error
:
self
.
socket
.
close
()
self
.
socket
.
close
()
raise
if
self
.
socktype
is
not
None
:
# user didn't specify falling back, so fail
raise
use_socktype
=
socket
.
SOCK_STREAM
self
.
socket
=
socket
.
socket
(
socket
.
AF_UNIX
,
use_socktype
)
try
:
self
.
socket
.
connect
(
address
)
# it worked, so set self.socktype to the used type
self
.
socktype
=
use_socktype
except
socket
.
error
:
self
.
socket
.
close
()
raise
# curious: when talking to the unix-domain '/dev/log' socket, a
# curious: when talking to the unix-domain '/dev/log' socket, a
# zero-terminator seems to be required. this string is placed
# zero-terminator seems to be required. this string is placed
...
...
Misc/NEWS
Dosyayı görüntüle @
4dc385b4
...
@@ -28,6 +28,9 @@ Core and Builtins
...
@@ -28,6 +28,9 @@ Core and Builtins
Library
Library
-------
-------
-
Issue
#
17795
:
Reverted
backwards
-
incompatible
change
in
SysLogHandler
with
Unix
domain
sockets
.
-
Issue
#
17555
:
Fix
ForkAwareThreadLock
so
that
size
of
after
fork
-
Issue
#
17555
:
Fix
ForkAwareThreadLock
so
that
size
of
after
fork
registry
does
not
grow
exponentially
with
generation
of
process
.
registry
does
not
grow
exponentially
with
generation
of
process
.
...
...
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