Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
e917052e
Commit
e917052e
authored
Apr 22, 2013
by
Vinay Sajip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #17795: Reverted backwards-incompatible change in SysLogHandler with Unix domain sockets.
parent
25187e66
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
5 deletions
+27
-5
Lib/logging/handlers.py
Lib/logging/handlers.py
+24
-5
Misc/NEWS
Misc/NEWS
+3
-0
No files found.
Lib/logging/handlers.py
View file @
e917052e
# 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
# documentation for any purpose and without fee is hereby granted,
...
...
@@ -18,7 +18,7 @@
Additional handlers for the logging package for Python. The core package is
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!
"""
...
...
@@ -767,7 +767,7 @@ class SysLogHandler(logging.Handler):
}
def
__init__
(
self
,
address
=
(
'localhost'
,
SYSLOG_UDP_PORT
),
facility
=
LOG_USER
,
socktype
=
socket
.
SOCK_DGRAM
):
facility
=
LOG_USER
,
socktype
=
None
):
"""
Initialize a handler.
...
...
@@ -786,18 +786,37 @@ class SysLogHandler(logging.Handler):
self
.
_connect_unixsocket
(
address
)
else
:
self
.
unixsocket
=
False
if
socktype
is
None
:
socktype
=
socket
.
SOCK_DGRAM
self
.
socket
=
socket
.
socket
(
socket
.
AF_INET
,
socktype
)
if
socktype
==
socket
.
SOCK_STREAM
:
self
.
socket
.
connect
(
address
)
self
.
socktype
=
socktype
self
.
formatter
=
None
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
:
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
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
def
encodePriority
(
self
,
facility
,
priority
):
"""
...
...
Misc/NEWS
View file @
e917052e
...
...
@@ -36,6 +36,9 @@ Core and Builtins
Library
-------
- Issue #17795: Reverted backwards-incompatible change in SysLogHandler with
Unix domain sockets.
- Issue #17555: Fix ForkAwareThreadLock so that size of after fork
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