Logs are very delayed
Hey! Logs from my discord bot are highly delayed on railway. They take upto 20-30 seconds to appear. Can this be fixed?
30 Replies
Sometimes they dont even arrive until I restart, then it shows up above
Railway’s logs aren’t the best. i’ve found good results setting flush= True on my print statements in python. Not sure about other languages
This is more on Python than our logging platform :/
p99 of logs show up within a second on being sent to the ingesting engine. If you've got issues would love to hear em.
Happy to dig in wherever needed too
Gotcha, thanks for the clarification
I would disagree, I've used D.Os App platform with the same code and the logs used to be displayed instantly, granted I would have to refresh the page if I have been inactive for it to repopulate it but the the logs would be instantly shown.
What language/framework etc
Python
A discord bot on dpy
WellThereItIs
Yeah but it's just a suprise because both heroku and d.o didn't have this issue
Do you have PYTHONUNBUFFERED=TRUE?
What's that?
In variables? Default behavior is to buffer logs
Env variables?
Yep
No I don't, didn't know that was a thing!
DO and Heroku will sometimes push stuff into your envs for you depending on the language
We’ve considered maybe doing something like that but don’t want to without letting people know
I don't need to change my code right? Just add PYTHONUNBUFFERED=TRUE and redeploy?
Yup
And if you add it, we’ll auto redeploy 🙂
Yeah but I think a popup would definitely help most people, I wasn't aware this even existed haha
I'll try this and let you know
Yep totally
It will take me some time to verify if this helps but atleast after the redeploy they seem to be much faster!
Also just wanted to let you guys know, when vars are changed, railway rebuilds and redeploys but the older deployment isnt removed which causes the application to connect 2 times.
Not sure if its intended
It has to be manually removed ^
It can take up to 30s sometimes to remove it
Takes about 30 seconds for the deployment to be removed usually
Ah gotcha thank youu!
Ill leave this open for 30 mins~ just to verify logs are working and then close it
You can set RAILWAY_DEPLOYMENT_OVERLAP_SECONDS=0 if you wanna change that
Damn thats pretty cool, you got a list of these secret env vars?
Hehehe, they should be in the docs I think
I dont see it <:fh_sigh:859551197186490390>
Oh I found a few
That