I want to rotate my logs of Django application, I am able to rotate the logs (based on size) successfully with logging module of python but its causing issue because same log file is getting accessed by celery process and other processes and because of that sometimes application is writing logs in debug.log.1 instead of debug.log file (assume my log file name is debug.log). I suspect this is because my celery process and django server (uwsgi server) is running by different user and because of permission issue it is behaving like that.
I am thinking of using logrotate of linux to rotate my log instead of using python class
logging.handlers.RotatingFileHandler
Can anyone help me in choosing the best way to rotate the log also if you can help me understand why my application is suddenly writing logs in debug.log.1 file instead of debug.log that would be great.