labthings / labthings/labthings-fastapi

Log propagation issue

Open Beginner friendly
#312 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
9
Forks
4
PR merge metrics
No merged PRs in 30d

Description

Describe the bug
Not all logs propagate to the root logger when serving with uvicorn.

In the OpenFlexure server we fix this by doing:

log_config = copy(uvicorn.config.LOGGING_CONFIG)
log_config["loggers"]["uvicorn"]["propagate"] = True
log_config["loggers"]["uvicorn.access"]["propagate"] = True

...

uvicorn.run(
    server.app,
    host=args.host,
    port=args.port,
    log_config=log_config,
    timeout_graceful_shutdown=2,
)

Note that log_config["loggers"]["uvicorn.access"]["propagate"] = True is a bit noisy, we filter out most of them when writing log files.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the server startup entry point that calls uvicorn.run and inspect how its logging configuration is passed. Reproduce serving with uvicorn, then verify that server logs reach the root logger while access-log noise remains appropriately filtered when writing log files.

Written by the indexing model from the issue text.

Assessment

Tech stack
fastapi, python
Domain
api, backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
64/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.