Override Laravel Queue Listener Output [Laravel <= 5.2 only]

Is there any way to override the output of the queue listener?

Processed: Illuminate\Queue\[email protected] not very useful, it would be nice if I could somehow display the name of the actual jobs and some parameters for what is actually being processed.

It breaks out in the code, and the class WorkCommanduses this line to display the name of the task, but my actual work class is not the same task that is used here.

$this->output->writeln('<error>['.Carbon::now()->format('Y-m-d H:i:s').'] Failed:</error> '.$job->getName());

+4
source share
1 answer

, . php artisan queue:work, .

Laravel WorkCommand writeOutput():

<?php // app/Console/Command/QueueWorkCommand.php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Contracts\Queue\Job;
use Illuminate\Queue\Console\WorkCommand;

class QueueWorkCommand extends WorkCommand
{
    /**
     * Write the status output for the queue worker.
     *
     * @param  \Illuminate\Contracts\Queue\Job  $job
     * @param  bool  $failed
     * @return void
     */
    protected function writeOutput(Job $job, $failed)
    {
        // ...
    }
}

app/Console/Kernel.php.

+2

All Articles