Railway python questions
- I heard when railway deploys a project after a git commit to the main branch, it's supposed to remove the previous deployment after it finishes, but when it's a python script (discord bot) it doesn't do that (the attached image is from using a template)
- When using
logging.getLogger().info("message")
, railway flags it as an error in logs, but when using print("message")
(not recommended to use) it's a normal log. Is there a way to fix this?Solution:Jump to solution
old deployments will be removed, refresh.
logs are red when logging to stderr, print() prints to stdout, i would highly recommend looking into JSON logging as railway has amazing support for it....
9 Replies
Project ID:
d7821c9a-e8f2-46c4-baee-82ab47fc0ae8
d7821c9a-e8f2-46c4-baee-82ab47fc0ae8
Solution
old deployments will be removed, refresh.
logs are red when logging to stderr, print() prints to stdout, i would highly recommend looking into JSON logging as railway has amazing support for it.
ah it does seem to remove it, it just takes a minute
and thanks, I'll look into it
the overlap is there as a default for websites/APIs to mitigate downtime, for discord bots that irrelevant, so you can disable the overlap by setting a service variable
RAILWAY_DEPLOYMENT_OVERLAP_SECONDS
to 0
in case anyone else searches for this, there's a nice python library named structlog that can give you json logging functionality built in:
output:
awsome, thanks for coming back with that info!!
thanks for this