crunzphp / crunz

A PHP-based job scheduler
MIT License
182 stars 17 forks source link

can't figure out how to get sendOutputTo to work #13

Closed judodan closed 2 years ago

judodan commented 2 years ago

Crunz version: 3.3.2

PHP version: 7.4.29/8.1.6

Operating system type and version:

CENTOS/MacOS Monterey

Description
using sendOutputTo command is not writing task output to file

How to reproduce
Simple task:

<?php
use Crunz\Schedule;

$schedule = new Schedule();

$taskToSchedule = $schedule->run(function () {
    echo 'Testing... 1, 2, 3', PHP_EOL;
});
    $taskToSchedule->everyMinute();
    $taskToSchedule->description('Description')
        ->sendOutputTo('/home/pinkele/public_html/testoutput.txt');

return $schedule;

I expect the output to be in the designated file, but it's not. This result is the same using CENTOS/PHP7.4.x or locally on my Mac using Monterey and either PHP7.4.x or 8.1.x

Possible Solution

Additional context
Cron job is configured to email me any output. I receive no emails, but if I remove the call to sendOutputTo, it behaves as expected and emails me the output of the task.

PabloKowalczyk commented 2 years ago

Turns out log_output must be set to true in crunz.yml file. It's in README: https://github.com/crunzphp/crunz#keeping-the-output

judodan commented 2 years ago

Interesting, that's not how I read that. However, I set the boolean and I'm in business! Thanks!