Skip to content

Commit

Permalink
Merge pull request #708 from nkaretnikov/port-reuse-562
Browse files Browse the repository at this point in the history
Log address and port, show exception trace from `uvicorn.run`
  • Loading branch information
Nikita Karetnikov authored Jan 5, 2024
2 parents ec60664 + dd6142f commit 57054ad
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions conda-store-server/conda_store_server/server/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,13 @@ 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.addHandler(logging.StreamHandler())
logger.setLevel(self.log_level)
logger.info(f"Starting server on {self.address}:{self.port}")

uvicorn.run(
fastapi_app,
host=self.address,
Expand All @@ -376,6 +383,11 @@ def start(self):
else []
),
)
except:
import traceback

traceback.print_exc()
raise
finally:
if self.standalone:
process.join()

0 comments on commit 57054ad

Please sign in to comment.