mrhan1993 / Fooocus-API

FastAPI powered API for Fooocus
GNU General Public License v3.0
511 stars 137 forks source link

需求 设置 禁用访问日志 #186

Closed aiwillcoming closed 5 months ago

aiwillcoming commented 5 months ago

增加启动参数 --no-access-log 以仅禁用访问日志,不更改日志级别。

mrhan1993 commented 5 months ago

什么意思?

aiwillcoming commented 5 months ago

INFO: 6:60826 - "GET /ping HTTP/1.1" 200 OK INFO: 40:46532 - "GET /ping HTTP/1.1" 200 OK INFO: :46536 - "GET /ping HTTP/1.1" 200 OK

uvicorn 的访问日志,刷太多了

mrhan1993 commented 5 months ago

你把 api.py 最后的启动函数改成下边的试试。

def start_app(arguments):
    file_utils.static_serve_base_url = arguments.base_url + "/files/"
    uvicorn.run(app="fooocusapi.api:app", host=arguments.host,
                port=arguments.port, log_level=arguments.log_level, access_log=False)

但这个应该会关掉所有 access log,至于更加细致的日志控制,等我研究研究。

aiwillcoming commented 5 months ago

加一个启动参数,其实大部分情况下 access log 没什么用

mrhan1993 commented 5 months ago

谁家服务器会关掉access log啊。你别瞎搞

aiwillcoming commented 5 months ago

一般外面还有一层nginx, 那里有更好的access log

aiwillcoming commented 5 months ago

可选控制就好