justpy
justpy copied to clipboard
justpy should log to a dedicated logger
Justpy currently uses logging.{info,debug}
which puts messages to the root logger. Would you accept a PR with config variable LOGGING_LOGGER
(similar to already existing LOGGING_LEVEL
) and define JustPy.log
as the logger object to use everywhere? Ocurrences of logging.info(...)
would be simply replaced by JustPy.log.info(...)
. The intention is to set logging verbosity for JustPy separately from other loggers.
Agreed. I started looking at OpenTracing to do this but haven´t come far enough as I needed to sort out some other things first. There´s a project that att OpenTracing to Starlette here that might be of help. https://github.com/acidjunk/starlette-opentracing
From the docs it look like it should be as easy as using Tortoise ORM in with Starlette/JustPy as it inject itself as a Starlette Middleware.
When you setup your service to run gunicorn, why not set it to log to whatever file you want?
[Unit]
Description=gunicorn daemon
#Requires=gunicorn.socket
After=network.target
[Service]
Type=notify
User=apache
Group=apache
RuntimeDirectory=gunicorn
WorkingDirectory=/path_to_your_project/
Environment=PYTHONUNBUFFERED=TRUE
ExecStart=/usr/local/bin/pipenv run gunicorn -k uvicorn.workers.UvicornWorker -b 127.0.0.1:8000 asgi:app --capture-output --log-level debug --error-logfile /path_to_your_project/error.log, --log-file /path_to_your_project/access.log
ExecReload=/bin/kill -s HUP $MAINPID
KillMode=mixed
TimeoutStopSec=5
PrivateTmp=true
[Install]
WantedBy=multi-user.target
Would you accept a PR with config variable
LOGGING_LOGGER
(similar to already existingLOGGING_LEVEL
) and defineJustPy.log
as the logger object to use everywhere?
Yes, if I recall correctly other people wanted this feature also
See #178 .