Repository navigation
Unify logging.handlers.SysLogHandler behavior with SocketHandlers #88457
Description
Activity
Probably we should make the behavior of SysLogHandler consistent with other Socket handlers.
Right now SocketHandler and DatagramHandler implement such behavior:
- on
closesetself.socket = None - when trying to send - make socket when it is None
SysLogHandler doesn't implement this behavior and when you close the socket for some reason (eg. restart of uWSGI server on code change) it leaves it in the closed state, then raises an error when you try to send any message because it is closed
--- Logging error --- Traceback (most recent call last): File "/usr/lib/python3.9/logging/handlers.py", line 959, in emit self.socket.sendto(msg, self.address) OSError: [Errno 9] Bad file descriptor- on
- added3.7 (EOL)end of lifeend of life3.8 (EOL)end of lifeend of life3.9 (EOL)end of lifeend of life3.10 (EOL)end of lifeend of life3.11only security fixesonly security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement
on Jun 2, 2021 1 remaining item
right now it has reconnection logic for unixsocket but not for tcp/udp
Should it not have UDP/TCP supported as well as domain sockets, before being reviewed?
Oh, sorry bad wording.
The current implementation has reconnection logic only for UNIX sockets
The patch adds reconnection logic for UDP/TCP sockets as well.I've done it with minimal changes to the existing code to accomplish that. And probably it can be merged.
But in general, it looks like we can refactor SysLogHandler to inherit from SocketHandler. Not sure if it should be done in this PR or better to create separate?
Oh, sorry bad wording.
OK, I see. Will take a look soon.
it looks like we can refactor SysLogHandler to inherit from SocketHandler. Not sure if it should be done in this PR
Better a separate PR for that, I feel.
Removing the older Pythons from the issue, as this is an enhancement request.
- removed3.7 (EOL)end of lifeend of life3.8 (EOL)end of lifeend of life3.9 (EOL)end of lifeend of life3.10 (EOL)end of lifeend of life
on Jun 5, 2021
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields: