Issue 33508: [logging] allow %p code to put PID into log filename (original) (raw)

Issue33508

Created on 2018-05-14 20:58 by steveha, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg316576 - (view) Author: Steve R. Hastings (steveha) * Date: 2018-05-14 20:58
Python logging is not multi-process safe. When a Python program has multiple processes, one way to log safely would be to put the process ID number into the filename of the log file, giving each process its own log file. It would be convenient if a %p format code would be expanded to the process ID number when the logging system opens the log file.
msg316602 - (view) Author: Vinay Sajip (vinay.sajip) * (Python committer) Date: 2018-05-14 22:31
> Python logging is not multi-process safe. Covered in https://docs.python.org/3/howto/logging-cookbook.html#logging-to-a-single-file-from-multiple-processes You can certainly arrange to have the pid in the filename without a change to the stdlib. I don't propose to implement this.
History
Date User Action Args
2022-04-11 14:59:00 admin set github: 77689
2018-05-15 07:49:31 vinay.sajip set status: open -> closedresolution: rejectedstage: resolved
2018-05-14 22:31:24 vinay.sajip set messages: +
2018-05-14 20:58:10 steveha create