From 26e28bcce1d5ecf9a58aef3935ad43fa9fe8a030 Mon Sep 17 00:00:00 2001 From: Nikita Karetnikov Date: Sun, 17 Dec 2023 00:42:08 +0100 Subject: [PATCH] Log address and port, show exception trace from `uvicorn.run` Fixes #562. --- conda-store-server/conda_store_server/server/app.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/conda-store-server/conda_store_server/server/app.py b/conda-store-server/conda_store_server/server/app.py index 674c7e0fe..7fe25a536 100644 --- a/conda-store-server/conda_store_server/server/app.py +++ b/conda-store-server/conda_store_server/server/app.py @@ -362,6 +362,12 @@ def start(self): process.start() try: + # Note: the logger needs to be defined here for the output to show + # up, self.log doesn't work here either + logger = logging.getLogger("app") + logger.setLevel(self.log_level) + logger.info(f"Starting server on {self.address}:{self.port}") + uvicorn.run( fastapi_app, host=self.address, @@ -376,6 +382,11 @@ def start(self): else [] ), ) + except: + import traceback + + traceback.print_exc() + raise finally: if self.standalone: process.join()