Skip to content

Commit 4133653

Browse files
authored
Add asctime to uvicorn stdout logs (#9210)
1 parent 771d9b3 commit 4133653

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
### Added
2+
3+
- Timestamps to Uvicorn stdout logs
4+
(<https://github.com/cvat-ai/cvat/pull/9210>)

cvat/settings/production.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,19 @@
1313
# https://github.com/moggers87/django-sendfile2
1414
SENDFILE_BACKEND = "django_sendfile.backends.nginx"
1515
SENDFILE_URL = "/"
16+
17+
LOGGING["formatters"]["verbose_uvicorn_access"] = {
18+
"()": "uvicorn.logging.AccessFormatter",
19+
"format": '[{asctime}] {levelprefix} {client_addr} - "{request_line}" {status_code}',
20+
"style": "{",
21+
}
22+
LOGGING["handlers"]["verbose_uvicorn_access"] = {
23+
"formatter": "verbose_uvicorn_access",
24+
"class": "logging.StreamHandler",
25+
"stream": "ext://sys.stdout",
26+
}
27+
LOGGING["loggers"]["uvicorn.access"] = {
28+
"handlers": ["verbose_uvicorn_access"],
29+
"level": "INFO",
30+
"propagate": False,
31+
}

0 commit comments

Comments
 (0)