Skip to content

Log context for Job Batch Callables #2

@bilfeldt

Description

@bilfeldt

The Correlation ID, Request ID and Client Request ID is currently added to each queued jobs payload and added to log context when the job is being processed. This works both with queued jobs, job chains and job batches.

Unfortunately I have not found a way to do this with the callables that can be used with job batches:

Bus::batch([
    new FirstJob(),
    new SecondJob(),
])->then(function (Batch $batch) {
    Log::debug('Then: All jobs completed successfully...'); // No context unfortunately
})->catch(function (Batch $batch, Throwable $e) {
    Log::debug('Catch: First batch job failure detected...'); // No context unfortunately
})->finally(function (Batch $batch) {
    Log::debug('Finally: The batch has finished executing...'); // No context unfortunately
})
    ->allowFailures()
    ->dispatch();

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions