Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I want to write terminal errors to a log file - LUMEN

I am using LUMEN framework.

I want to log or write all those errors which appears in console or terminal to a log file. So that I can see what errors are appearing in the process.

Currently I am running my LUMEN server using this command:

nohup php artisan queue:work --daemon & ?

So how can I get all those error in a log file?

Example errors I want to log:

    [Mon Jul  6 13:39:12 2015] 127.0.0.1:36615 [500]: /v1/user/fetchUser/ -
 Class 'App\Http\Controllers\V1\UserController' not found in /opt/lampp/htdocs/api/app/Http/Controllers/V1/ArticleController.php on line 504

[Tue Jul  7 11:11:59 2015] 127.0.0.1:37774 [500]: /v1/user/fetchUsers/
like image 412
New Co Avatar asked Dec 14 '25 18:12

New Co


1 Answers

You can redirect the output to a file like this:

nohup php artisan queue:work --daemon > ./queue_worker.log &

To save the terminal output to one file and errors to another:

nohup php artisan queue:work --daemon > output.log 2> errors.log &

like image 52
user2479930 Avatar answered Dec 16 '25 10:12

user2479930



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!