[issue43344] RotatingFileHandler breaks file type associations

2021-07-27 Thread Alexander Smirnov


Alexander Smirnov  added the comment:

the problem with namer solution is that it will stop respecting backupCount 
parameter

--
nosy: +alexander.smirnoff

___
Python tracker 
<https://bugs.python.org/issue43344>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44753] backupCount is not respected in TimedRotatingFileHandler when namer is specified

2021-07-27 Thread Alexander Smirnov


New submission from Alexander Smirnov :

after adding namer callable (like it is described in 
https://bugs.python.org/issue43344) to log handler configuration, it stopped 
removing old files

log_filename = os.path.join(log_dir, "application.log")
log_handler = logging.handlers.TimedRotatingFileHandler(log_filename, 
when='MIDNIGHT', interval=1, backupCount=7)

// after adding this line, old files are not deleted
log_handler.namer = lambda name: name.replace(".log", "") + ".log"

--
components: Library (Lib)
messages: 398326
nosy: alexander.smirnoff
priority: normal
severity: normal
status: open
title: backupCount is not respected in TimedRotatingFileHandler when namer is 
specified
versions: Python 3.8

___
Python tracker 
<https://bugs.python.org/issue44753>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue43344] RotatingFileHandler breaks file type associations

2021-07-28 Thread Alexander Smirnov


Alexander Smirnov  added the comment:

the namer was implemented to add "*.log" extension, to avoid broken file 
association problem.

```
log_handler.namer = lambda name: name.replace(".log", "") + ".log"
```

>implemented carefully enough
Could you please share best practices, looks like this documentation is missing.

I created a separate issue related to disregarding of backupCount configuration 
- https://bugs.python.org/issue44753

--

___
Python tracker 
<https://bugs.python.org/issue43344>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com