Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

console log output missing time #209

Closed
downdawn opened this issue Sep 5, 2023 · 8 comments · Fixed by #347
Closed

console log output missing time #209

downdawn opened this issue Sep 5, 2023 · 8 comments · Fixed by #347
Labels
deferred Delayed, pending further research or updates

Comments

@downdawn
Copy link
Collaborator

downdawn commented Sep 5, 2023

Hi, @wu-clan

Missing crucial time data, is there a way to customize the output?

INFO:     127.0.0.1:0 - "GET /api/v1/menus/sidebar HTTP/1.0" 200 OK
@wu-clan
Copy link
Member

wu-clan commented Sep 5, 2023

We've added database request logging

Adding log file records is easy

This printout is from uvicorn: https://www.uvicorn.org/settings/#logging

@wu-clan
Copy link
Member

wu-clan commented Sep 5, 2023

This is helpful, from an unmerged PR:https://github.com/encode/uvicorn/pull/2031/files#diff-b4d68dc855d0f9476d3f2ee343853bd21bf82ea9960d0cf06661baa244439dd6

If you like middleware, maybe you can also use the asgi-logger

@downdawn
Copy link
Collaborator Author

downdawn commented Sep 7, 2023

Waiting for the official pull request.

@downdawn downdawn closed this as completed Sep 7, 2023
@downdawn downdawn reopened this Oct 12, 2023
@downdawn
Copy link
Collaborator Author

        log_config = uvicorn.config.LOGGING_CONFIG
        fmt = "%(levelprefix)s %(client_addr)s - %(asctime)s - \"%(request_line)s\" %(status_code)s"
        log_config["formatters"]["access"]["fmt"] = fmt
        uvicorn.run(
            app=f'{Path(__file__).stem}:app',
            host=settings.UVICORN_HOST,
            port=settings.UVICORN_PORT,
            reload=settings.UVICORN_RELOAD,
        )

This configuration can output time information normally locally, but deployment with gunicorn+supervisor still does not take effect.

@downdawn
Copy link
Collaborator Author

@wu-clan
Copy link
Member

wu-clan commented Oct 12, 2023

It seems to me that the officials don't care about prioritizing this and there's nothing we can do about it

@wu-clan wu-clan added the deferred Delayed, pending further research or updates label Dec 23, 2023
@wu-clan wu-clan closed this as completed Mar 22, 2024
@wu-clan
Copy link
Member

wu-clan commented May 30, 2024

uvicorn 0.30.0 released: https://www.uvicorn.org/release-notes/

Not sure if this problem has been solved, if you are interested, please try.

@wu-clan wu-clan reopened this May 30, 2024
@wu-clan
Copy link
Member

wu-clan commented Jul 9, 2024

If you want to set up gunicorn logs, refer to: https://gist.github.com/dishwad/c9b24ee7f9c5c710bae4c2f31d8667a7

@wu-clan wu-clan linked a pull request Jul 9, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deferred Delayed, pending further research or updates
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants