Skip to content

Clarification requested for library/syslog.rst #92412

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

Closed
Gaasmann opened this issue May 6, 2022 · 2 comments
Closed

Clarification requested for library/syslog.rst #92412

Gaasmann opened this issue May 6, 2022 · 2 comments
Labels
docs Documentation in the Doc dir

Comments

@Gaasmann
Copy link
Contributor

Gaasmann commented May 6, 2022

Hello,
While translating library/syslog.rst we've realized that the comment "Changed in 3.2" for syslog.openlog() seems ambiguous:
https://docs.python.org/3/library/syslog.html#syslog.openlog

In previous versions, keyword arguments were not allowed, and ident was
required. The default for ident was dependent on the system libraries,
and often was python instead of the name of the Python program file.

As ident was required before 3.2, it couldn't have a default value, so the sentence seems contradictory.
The documentation for 3.1 shows that ident is mandatory and the tests on the 3.1.5 distribution always define ident when calling openlog().

Could someone help us understand the meaning of this sentence?

Thanks

@Gaasmann Gaasmann added the docs Documentation in the Doc dir label May 6, 2022
Gaasmann added a commit to Gaasmann/python-docs-fr that referenced this issue May 6, 2022
Une demande d'éclaircissement sur la doc originale a été ouverte.
python/cpython#92412
@hauntsaninja
Copy link
Contributor

I think this makes a little bit more sense in the context of the 3.1 docs (https://docs.python.org/3.1/library/syslog.html#syslog.openlog ):

Logging options other than the defaults can be set by explicitly opening the log file with openlog() prior to calling syslog(). The defaults are (usually) ident = 'syslog', logopt = 0, facility = LOG_USER.

So the defaults are what you get when you use syslog without openlog. But take it with a grain of salt, I don't really understand the code, in particular, I don't understand the claim in 3.1's docs that ident usually equalled syslog

Some more links:
13daf12
https://bugs.python.org/issue8451
https://mail.python.org/pipermail/python-dev/2010-March/098500.html

@Gaasmann
Copy link
Contributor Author

Gaasmann commented May 7, 2022

Yes, that sounds right. Like you, I don't get the claim you mentioned.

From what I see,

  • before the patch syslog.openlog fails and the C's openlog isn't called
  • after the patch C's openlog is called with ident = NULL.

In both cases, it seems the decision for what to use for ident is up to the syslog implementation (the man page on Debian says that POSIX.1-2008 does not specify the behavior when ident is NULL.)

So, most of the time, it seems that syslog uses C's basename(argv[0]) but maybe some systems would behave differently and use syslog for ident?

In any case, even with the patch, it seems that the syslog implementation would decide the ident's value if sys.argv[0] == ''

If what I said above is right, I would remove the second line of the "Changed in 3.2" as it could still be true:

The default for ident was dependent on the system libraries, and often was python instead of the name of the Python program file.

jeanas added a commit to python/python-docs-fr that referenced this issue May 7, 2022
Marque une entrée de library/syslog.po comme fuzzy.

Une demande d'éclaircissement sur la doc originale a été ouverte.
python/cpython#92412

Co-authored-by: Jean Abou-Samra <[email protected]>
JulienPalard pushed a commit to python/python-docs-fr that referenced this issue May 22, 2022
Marque une entrée de library/syslog.po comme fuzzy.

Une demande d'éclaircissement sur la doc originale a été ouverte.
python/cpython#92412

Co-authored-by: Jean Abou-Samra <[email protected]>
JulienPalard pushed a commit to python/python-docs-fr that referenced this issue May 22, 2022
Marque une entrée de library/syslog.po comme fuzzy.

Une demande d'éclaircissement sur la doc originale a été ouverte.
python/cpython#92412

Co-authored-by: Jean Abou-Samra <[email protected]>
@slateny slateny closed this as completed Jul 30, 2022
ambv pushed a commit that referenced this issue Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
None yet
Development

No branches or pull requests

3 participants