How does storage work inside railway?
I know it's ephemeral and it gets deleted after the next build. Every time I fetch a log file created from laravel it spits out a file not found error.
is there a special path that I need to navigate to get the logs?
Solution:Jump to solution
Update: this seems to fix the issue with cron logs not getting picked up by laravel while at the same time sharing this instace
It seems like railway doesn't create the logs sub directory, it's getting saved inside the root of the storage path...
16 Replies
Project ID:
N/A
N/A
The log files will be created wherever you specify that they should be. Storage in Railway is ephemeral, but Railway recently released volumes which are not.
Laravel
storage_path()
saves the log files inside /var/app/www/
(can't remember the full path, but you get the idea) but when fetching it, it returns a file not found error, by any chance is it because of permissions?
Or are storages separated by instances?
I have 2 instances running, 1 for CRON and the other for fetching the log file exclusivelyServices have separate storage
for logs you will want to direct all logging to stdout and stderr
someone stated at the laracast forum that inorder to use the scheduler, this should be ran
php artisan schedule:run >> /dev/null 2>&1
But this doesn't seem to output anything, my env is set to stdout for logging
Is it possible to add a project ID for this thread?little insider knowledge, us community members can't do anything with the project id, project Ids are only needed when there's an issue with the platform, so in your case no project id required
Solution
Update: this seems to fix the issue with cron logs not getting picked up by laravel while at the same time sharing this instace
It seems like railway doesn't create the logs sub directory, it's getting saved inside the root of the storage path
How do I mark this thread as resolved?
why are you returning logs through a php file? you should be sending logs to stdout and stderr so that you can view the logs in the railway ui
Running
php artisan schedule:run >> /dev/null 2>&1
only outputs what's running inside the log viewer but it doesn't include the command's outputs, I still have no clue how to output cron logs to stdout. running them using their respective command logs them to stdout and stderr though, problem with running them without the scheduler is that they overlap
Running php artisan schedule:run >> /dev/null 2>&1 only outputs what's running inside the log viewer
By this, I mean, it only outputs Schedule X has ran... bla bla bla
to the log vieweraren't you directing the output to /dev/null ??
tried running without
/dev/null
locally, still outputs the same thing, the command itself is outputting it to laravel.log
or output.log
in this caseyou'll need to find a way to redirect all logging to stdout
I'll figure something out, right now I'm happy with the current result