R
Railwayβ€’16mo ago
beshralghalil

Custom logs files

I moved from using pythonanywhere to Railway to host my discord bot. I used to write logs to files as follows bot.log, errors.log, anddb.log where errors.log contain errors from all other log files for fast errors tracking. The problem is railway uses docker containers as far as I understand and I am not really into docker. Is there a way to live read a log file specifically errors.log from inside the service container? or I just have to change the way I handle logging?
Solution:
send info, debug, and warn logs to stdout, they will then appear in the deployment logs send error logs to stderr, they will appear in red in the deployment logs...
Jump to solution
16 Replies
Percy
Percyβ€’16mo ago
Project ID: N/A
beshralghalil
beshralghalilOPβ€’16mo ago
N/A
Solution
Brody
Brodyβ€’16mo ago
send info, debug, and warn logs to stdout, they will then appear in the deployment logs send error logs to stderr, they will appear in red in the deployment logs
Brody
Brodyβ€’16mo ago
but yeah you will need to do the tiny change of logging to stdout/stderr instead of files
beshralghalil
beshralghalilOPβ€’16mo ago
Considered. Thank you very much.
Brody
Brodyβ€’16mo ago
no problem πŸ™‚
beshralghalil
beshralghalilOPβ€’16mo ago
Is there anyway I can exec to service container ?
Brody
Brodyβ€’16mo ago
there is not, what would you need it for though? maybe we can come up with a work around
beshralghalil
beshralghalilOPβ€’16mo ago
Yep, I'll find a way around it. thx.
Brody
Brodyβ€’16mo ago
haha maybe you missed my question there?
beshralghalil
beshralghalilOPβ€’16mo ago
I did not. I just realized my reason is stupid enough and there is a way around it.πŸ˜†
Brody
Brodyβ€’16mo ago
tell me anyway πŸ™‚
beshralghalil
beshralghalilOPβ€’16mo ago
I just want to get the old log files from the container before the next deployment. but I think they are available in the deployment logs.
Brody
Brodyβ€’16mo ago
if they're also logged to stdout/stderr, they're in the deployment logs, if they where only logged to files, then they're essentially gone
beshralghalil
beshralghalilOPβ€’16mo ago
yep they're logged to stdout/stderr.
Brody
Brodyβ€’16mo ago
perfect
Want results from more Discord servers?
Add your server