Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

syslog.syslog() does not return error when unable to send the log #69038

Closed
CyrilBouthors mannequin opened this issue Aug 12, 2015 · 4 comments
Closed

syslog.syslog() does not return error when unable to send the log #69038

CyrilBouthors mannequin opened this issue Aug 12, 2015 · 4 comments
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@CyrilBouthors
Copy link
Mannequin

CyrilBouthors mannequin commented Aug 12, 2015

BPO 24850
Nosy @bitdancer, @vadmium

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:

assignee = None
closed_at = <Date 2015-08-25.12:37:35.672>
created_at = <Date 2015-08-12.17:01:25.510>
labels = ['invalid', 'type-feature', 'library']
title = 'syslog.syslog() does not return error when unable to send the log'
updated_at = <Date 2015-08-25.12:37:35.671>
user = 'https://bugs.python.org/CyrilBouthors'

bugs.python.org fields:

activity = <Date 2015-08-25.12:37:35.671>
actor = 'r.david.murray'
assignee = 'none'
closed = True
closed_date = <Date 2015-08-25.12:37:35.672>
closer = 'r.david.murray'
components = ['Library (Lib)']
creation = <Date 2015-08-12.17:01:25.510>
creator = 'Cyril Bouthors'
dependencies = []
files = []
hgrepos = []
issue_num = 24850
keywords = []
message_count = 4.0
messages = ['248462', '248465', '249099', '249116']
nosy_count = 3.0
nosy_names = ['r.david.murray', 'martin.panter', 'Cyril Bouthors']
pr_nums = []
priority = 'normal'
resolution = 'not a bug'
stage = 'resolved'
status = 'closed'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue24850'
versions = ['Python 3.6']

@CyrilBouthors
Copy link
Mannequin Author

CyrilBouthors mannequin commented Aug 12, 2015

Hi guys,

syslog.syslog() does not report any error when it fails to send messages to syslog. To reproduce:

Stop sysglog:

sudo /etc/init.d/rsyslog stop

Run than Python code:

import syslog
syslog.syslog('test')

It does not fail.

Strace shows that's it's been unable to send the message to syslog:

connect(3, {sa_family=AF_LOCAL, sun_path="/dev/log"}, 110) = -1 ENOENT (No such file or directory)
close(3) = 0
rt_sigaction(SIGINT, {SIG_DFL, [], SA_RESTORER, 0x7fc899e4a8d0}, {0x55e6b0, [], SA_RESTORER, 0x7fc899e4a8d0}, 8) = 0
brk(0x20ed000) = 0x20ed000
exit_group(0) = ?
+++ exited with 0 +++

I've tested all those versions:

echo -e "import syslog\nsyslog.syslog('test')\n" | python3.5
echo -e "import syslog\nsyslog.syslog('test')\n" | python3.4
echo -e "import syslog\nsyslog.syslog('test')\n" | python3.3
echo -e "import syslog\nsyslog.syslog('test')\n" | python3.2
echo -e "import syslog\nsyslog.syslog('test')\n" | python2.7
echo -e "import syslog\nsyslog.syslog('test')\n" | python2.6

Can we please get syslog() to report errors?

Thanks.

@CyrilBouthors CyrilBouthors mannequin added type-bug An unexpected behavior, bug, or error stdlib Python modules in the Lib dir labels Aug 12, 2015
@bitdancer
Copy link
Member

Hmm. Normally the way errors are reported in python is via exception. personally I would not want syslog raising an exception if it couldn't deliver the message.

I suppose we could have it return a status code. That would be a new feature, though.

@bitdancer bitdancer added type-feature A feature request or enhancement and removed type-bug An unexpected behavior, bug, or error labels Aug 12, 2015
@vadmium
Copy link
Member

vadmium commented Aug 25, 2015

I’ve never used syslog() in Python, but I thought I should point out that the standard Posix API does not do any error reporting either. See <http://pubs.opengroup.org/onlinepubs/9699919799/functions/syslog.html\>: “The . . . functions shall not return a value. / No errors are defined.”

@bitdancer
Copy link
Member

Ah, in that case there aren't any errors for us to return, so this is moot.

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement
Projects
None yet
Development

No branches or pull requests

2 participants