AnswerDotAI / AnswerDotAI/fasthtml

[FEATURE] Logging for production service

Open
#559 1 comment 3 reactions 0 assignees View on GitHub
enhancement
Dominant language
Jupyter Notebook
Stars
7k
Forks
319
Avg merge
28m
Merged PRs (30d)
3

Description

If you'd like to discuss your feature idea first with the community (highly recommended!) please visit our [Discord channel](https://discord.gg/qcXvcxMhdP).

**Is your feature request related to a problem? Please describe.**
using the standard logging, e.g.
```python
import logging
logger = logging.getLogger(__name__)
logger.setLevel(logging.DEBUG)
logger.debug("TEST")
```
doesn't work when using `serve()` or even `uvicorn.run()` or `uvicorn main:app...`.

**Describe the solution you'd like**
I was able to solve it by inspecting uvicorn's logging configuration and just naming all my loggers `uvicorn`, e.g. in each module `logger = logging.getLogger("uvicorn")`, but it would be nice to be able to use the standard logging idiom.

**Example code**
See above.

**Problem solved**
Explain what problem this feature would solve and how it would benefit users of the library:
It would allow users to use logging for production.

**Additional context**
It seems this is a tricky problem for uvicorn in general, probably because of things running async, because a lot of people have a hard time getting uvicorn logging to work apparently.

**Confirmation**
Please confirm the following:
- [x] I have checked the existing issues and pull requests to ensure this feature hasn't been requested before.
- [x] I have read the project's documentation to ensure this feature doesn't already exist.

Contributor guide

Open the contributing guide

Research direction

Reproduce the issue using the shown logging example with serve(), uvicorn.run(), and the uvicorn main:app command, then inspect Uvicorn's logging configuration. Done means applications can use the standard logger idiom without naming loggers "uvicorn" and receive production-usable output in each launch mode.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend, observability-sre
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.