R
Railwayβ€’10mo 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β€’10mo ago
Project ID: N/A
beshralghalil
beshralghalilβ€’10mo ago
N/A
Solution
Brody
Brodyβ€’10mo 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β€’10mo ago
but yeah you will need to do the tiny change of logging to stdout/stderr instead of files
beshralghalil
beshralghalilβ€’10mo ago
Considered. Thank you very much.
Brody
Brodyβ€’10mo ago
no problem πŸ™‚
beshralghalil
beshralghalilβ€’10mo ago
Is there anyway I can exec to service container ?
Brody
Brodyβ€’10mo ago
there is not, what would you need it for though? maybe we can come up with a work around
beshralghalil
beshralghalilβ€’10mo ago
Yep, I'll find a way around it. thx.
Brody
Brodyβ€’10mo ago
haha maybe you missed my question there?
beshralghalil
beshralghalilβ€’10mo ago
I did not. I just realized my reason is stupid enough and there is a way around it.πŸ˜†
Brody
Brodyβ€’10mo ago
tell me anyway πŸ™‚
beshralghalil
beshralghalilβ€’10mo 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β€’10mo 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
beshralghalilβ€’10mo ago
yep they're logged to stdout/stderr.
Brody
Brodyβ€’10mo ago
perfect