michabbb / laravel-scheduler-watcher

Easy logging & monitoring of your Laravel cronjobs
MIT License
8 stars 4 forks source link

appendOutputTo() not working #5

Closed jamesj2 closed 4 years ago

jamesj2 commented 4 years ago

I'm on Laravel 5.8 and don't want the output going to /tmp. I currently use appendOutputTo() but I was unable to get it to work with laravel-scheduler-watcher.

$schedule->command('dummy:test blabla -c')->everyMinute()->appendOutputTo(storage_path('logs/cron.log'))->description('Call dummy test [log,nooutput,force]');
michabbb commented 4 years ago

my monitor class uses "sendOutputTo" - that is used globally for all cron-jobs that should get logged, because it´s impossible to get the output without logging it to file. i need the output in a separate file to put it into the DB. having only one big file would make it impossible to get the output of a single run. i don´t know, but i believe it won´t be possible to use "appendOutputTo" and "sendOutputTo" at the same time. the only thing that comes into my mind is, to add a new option in the config, something like

[ 'global_logfile' => '/var/log/cron.log' ]

and append the output of each run to this file. but, you must be aware, if you use [log] with your cron, you give up control to the monitor and some things are getting overwritten.

right now, i am using sys_get_temp_dir() as path catching the output, of course, we can replace that with another value of the config. but that has nothing todo with your "i want everything in one big file"... that has to be done manually inside the monitor.

michabbb commented 4 years ago

besides all that, this package is made for laravel 7, if it works with older versions, i don´t care, sorry. and the most important thing: i only use PHP 7.4 with that project here and i don´t want to support old stuff. i didn´t made that clear in my very first commit, sorry for that. so i guess the best solution for you is to fork this project and adjust it to your needs, because with my standards i guess this project does not fit into your old code.... 😕

michabbb commented 4 years ago

@jamesj2 you only have to change this "IF" in case you want logging without any output: https://github.com/michabbb/laravel-scheduler-watcher/blob/master/src/LaravelSchedulerWatcher.php#L72