[9.x] Add configurable timezone support for WorkCommand output timestamps #45722
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Introduces a new configuration option
queue.log_timezone
, so that thephp artisan queue:work
command can output the timestamps in a different timezone than the in application defaultapp.timezone
.The rationale for this addition is that this is already doable for log files made through Log facade with
Log::setTimezone
but the WorkCommand is not using the Logging subsystem but Console\OutputStyle to write directly back to the stdout and stderr.When we're pushing the logs from the
php artisan queue:work
to a logging service like AWS Cloudwatch, it expects the timestamps to be in UTC but the previously used application default timezone can be something else leading to discrepancy between Log::'ed log files and console command output. In this specific case Cloudwatch isn't too happy about timestamps happening in the future.The configuration has been added as optional. If it has not been defined, the code uses the current application timezone.