Message403371
One way to disable logging in a configuration file is to use /dev/null as the filename for logs. It is fine to use that with FileHandler.
The problem is when TimedRotatingFileHandler is used. When Python decides to rotate the "file", it calls os.rename() on /dev/null *device* and create a new /dev/null *file* which will be quickly filled by all applications on the system writing into /dev/null.
The problem is only possible if the process is allowed to rename the device /dev/null. For example, a regular user gets a permission error.
I see different options:
* TimedRotatingFileHandler should disable rotation if it detects that the file is a device (not a regular file)
* logging should switch to NullHandler if filename is equal to os.path.devnull.
I guess that the problem is the same if the filename points to a socket or a named pipe.
RotatingFileHandler may also be affected, I didn't check.
... I'm quite sure that I had the same issue with Twisted years ago, but I don't recall the details :-) Twisted didn't use the logging module if I recall correctly.
RHEL downstream issue: https://bugzilla.redhat.com/show_bug.cgi?id=2009200 |
|
Date |
User |
Action |
Args |
2021-10-07 09:47:34 | vstinner | set | recipients:
+ vstinner, vinay.sajip |
2021-10-07 09:47:34 | vstinner | set | messageid: <1633600054.24.0.602209276715.issue45401@roundup.psfhosted.org> |
2021-10-07 09:47:34 | vstinner | link | issue45401 messages |
2021-10-07 09:47:34 | vstinner | create | |
|