[9.x] Add configurable timezone support for WorkCommand output timestamps#45722
Merged
taylorotwell merged 3 commits intoJan 19, 2023
Merged
Conversation
…output timestamp timezone with optional configuration key 'queue.log_timezone'
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:workcommand 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::setTimezonebut 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:workto 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.