I am about to configure a python logging system using the dictconfig format in settings.py as suggested by Django.
For effectiveness, I would like to log entries in monthly splitted log files regardless of number of days in the month (or, in the future, depending of workload of my project, by iso week number). Unfortunately, the python's TimedRotatingFileHandler
can't do that.
I had the idea to use the standard FileHandler
and dynamically change the filename (customizing it btw).
'fichierMensuelCustom': {
'level': 'INFO',
'class': 'logging.FileHandler',
'filename': lambda x: 'logs/projet/projet_{0}.log'.format(time.strftime('%m-%Y')),
'formatter': 'complet'
},
(please don't laugh at it) It doesn't work, I'm stuck… Any suggestions?