Fix logging with rotation

This commit is contained in:
2024-04-18 00:03:44 +02:00
parent e121c6dc39
commit 382cf5d501
+10
View File
@@ -1,3 +1,4 @@
from logging import handlers
import re import re
import logging import logging
import threading import threading
@@ -313,6 +314,15 @@ async def get_partial():
#=======================================MAIN=================================================== #=======================================MAIN===================================================
if __name__ == "__main__": if __name__ == "__main__":
app.logger.setLevel(logging.DEBUG) app.logger.setLevel(logging.DEBUG)
h1 = handlers.RotatingFileHandler(
filename="E:\\logs\\librarian.log",
encoding="utf-8",
mode="a",
maxBytes=6 * 1024 * 1024,
backupCount=6,
)
app.logger.addHandler(h1)
threads = [] threads = []
threads.append(threading.Thread(target=waitress_run)) threads.append(threading.Thread(target=waitress_run))
#threads.append(threading.Thread(target=flask_debug)) #threads.append(threading.Thread(target=flask_debug))