关闭flask日志
This commit is contained in:
@@ -21,6 +21,13 @@ from script.ScriptManager import ScriptManager
|
|||||||
from Entity.Variables import addModelToAnchorList, wdaFunctionPort
|
from Entity.Variables import addModelToAnchorList, wdaFunctionPort
|
||||||
import Entity.Variables as ev
|
import Entity.Variables as ev
|
||||||
from Utils.JsonUtils import JsonUtils
|
from Utils.JsonUtils import JsonUtils
|
||||||
|
import logging
|
||||||
|
|
||||||
|
for name in ('werkzeug', 'werkzeug.serving'):
|
||||||
|
log = logging.getLogger(name)
|
||||||
|
log.disabled = True
|
||||||
|
log.propagate = False
|
||||||
|
log.handlers.clear()
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
CORS(app)
|
CORS(app)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
import logging
|
||||||
import subprocess
|
import subprocess
|
||||||
import sys
|
import sys
|
||||||
import threading
|
import threading
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import sys
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
from Utils.LogManager import LogManager
|
from Utils.LogManager import LogManager
|
||||||
|
import logging
|
||||||
|
|
||||||
if "IOSAI_PYTHON" not in os.environ:
|
if "IOSAI_PYTHON" not in os.environ:
|
||||||
base_path = Path(sys.argv[0]).resolve()
|
base_path = Path(sys.argv[0]).resolve()
|
||||||
@@ -48,8 +49,11 @@ def main(arg):
|
|||||||
# 项目入口
|
# 项目入口
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
|
# 禁止flask相关输出写入日志
|
||||||
|
logging.getLogger('werkzeug').disabled = True
|
||||||
|
|
||||||
# 清空日志
|
# 清空日志
|
||||||
# LogManager.clearLogs()
|
LogManager.clearLogs()
|
||||||
|
|
||||||
# main(sys.argv)
|
# main(sys.argv)
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -194,6 +194,7 @@ class LogManager:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def clearLogs(cls):
|
def clearLogs(cls):
|
||||||
|
print("清空日志")
|
||||||
"""启动时清空 log 目录下所有文件"""
|
"""启动时清空 log 目录下所有文件"""
|
||||||
# 先关闭所有 logger 的文件句柄
|
# 先关闭所有 logger 的文件句柄
|
||||||
for _, logger in logging.Logger.manager.loggerDict.items():
|
for _, logger in logging.Logger.manager.loggerDict.items():
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user