specific log files for commands and jobs
This commit is contained in:
@@ -7,6 +7,7 @@ use Illuminate\Console\Attributes\Description;
|
||||
use Illuminate\Console\Attributes\Signature;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Support\Facades\Http;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
#[Signature('jobs:summary {--batch=50}')]
|
||||
#[Description('Command description')]
|
||||
@@ -18,12 +19,24 @@ class GenerateJobSummaryCommand extends Command
|
||||
public function handle()
|
||||
{
|
||||
$batchSize = (int) $this->option('batch');
|
||||
$log = Log::channel('jobs_summary');
|
||||
$log->info('Starting summary generation', ['batch_size' => $batchSize]);
|
||||
|
||||
$jobs = $this->getJobs($batchSize);
|
||||
$processed = 0;
|
||||
$failed = 0;
|
||||
|
||||
foreach ($jobs as $job) {
|
||||
$this->processJob($job);
|
||||
try {
|
||||
$this->processJob($job);
|
||||
$processed++;
|
||||
} catch (\Exception $e) {
|
||||
$failed++;
|
||||
$log->error("Failed to generate summary for job #{$job->id}", ['error' => $e->getMessage()]);
|
||||
}
|
||||
}
|
||||
|
||||
$log->info('Summary generation complete', ['processed' => $processed, 'failed' => $failed]);
|
||||
}
|
||||
|
||||
private function getJobs(int $batchSize)
|
||||
|
||||
Reference in New Issue
Block a user