Django not rotating logs
|Reported by:||mikewash||Owned by:||nobody|
|Has patch:||no||Needs documentation:||no|
|Needs tests:||no||Patch needs improvement:||no|
I was trying to rotate logs in django but it kept delivering this error [Windows Error 32] when running it in the development environment (python manage.py runserver). I was curious if there is some way to rotate logs to work in sync with the Django Framework.
Also I placed the code in the settings.py file.
Here is the code
logger = logging.getLogger("") logger.setLevel(logging.DEBUG) handler = logging.handlers.RotatingFileHandler(LOG_FILE, maxBytes=20, backupCount=5) handler.setFormatter(logging.Formatter(LOG_FORMAT)) logger.addHandler(handler)