added log rotation

This commit is contained in:
Kirill Zhukov 2022-12-28 17:57:00 +01:00
parent 798f7e4b65
commit 7844a44a74

View File

@ -5,6 +5,7 @@ results available via API Call
from aiohttp import web from aiohttp import web
import copy import copy
import logging import logging
from logging.handlers import RotatingFileHandler
import threading import threading
from time import sleep from time import sleep
import json import json
@ -72,7 +73,8 @@ def start():
logging.basicConfig(level=logging.INFO, logging.basicConfig(level=logging.INFO,
format='%(asctime)s %(levelname)s %(funcName)s %(message)s', format='%(asctime)s %(levelname)s %(funcName)s %(message)s',
handlers=[logging.FileHandler(LOG_FILE, mode='a'), handlers=[logging.FileHandler(LOG_FILE, mode='a'),
logging.StreamHandler()]) logging.StreamHandler(),
RotatingFileHandler(LOG_FILE, maxBytes=10000, backupCount=3)])
logging.info("Trying to load diff file from disk") logging.info("Trying to load diff file from disk")
try: try: