From e4c0102b3cccb2fc62f312b01f0846f0849c28ef Mon Sep 17 00:00:00 2001 From: Lincoln Stein Date: Thu, 27 Jul 2023 11:59:29 -0400 Subject: [PATCH] unified uvicorn access log entries too --- invokeai/app/api_app.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/invokeai/app/api_app.py b/invokeai/app/api_app.py index 626de33345..d4fbff9ede 100644 --- a/invokeai/app/api_app.py +++ b/invokeai/app/api_app.py @@ -223,11 +223,15 @@ def invoke_api(): ) server = uvicorn.Server(config) + all_loggers = [logging.getLogger(name) for name in logging.root.manager.loggerDict] + # replace uvicorn's logger with InvokeAI's for consistent appearance - logging.getLogger("uvicorn").handlers.clear() - for ch in logger.handlers: - logging.getLogger("uvicorn").addHandler(ch) - + for logname in ["uvicorn", "uvicorn.access", "uvicorn.error"]: + l = logging.getLogger(logname) + l.handlers.clear() + for ch in logger.handlers: + l.addHandler(ch) + loop.run_until_complete(server.serve()) if __name__ == "__main__":