Skip to content

[9.x] Add configurable timezone support for WorkCommand output timestamps#45722

Merged
taylorotwell merged 3 commits into
laravel:9.xfrom
trm42:queue-work-configurable-timestamp-timezone
Jan 19, 2023
Merged

[9.x] Add configurable timezone support for WorkCommand output timestamps#45722
taylorotwell merged 3 commits into
laravel:9.xfrom
trm42:queue-work-configurable-timestamp-timezone

Conversation

@trm42
Copy link
Copy Markdown
Contributor

@trm42 trm42 commented Jan 19, 2023

Introduces a new configuration option queue.log_timezone, so that the php artisan queue:work command can output the timestamps in a different timezone than the in application default app.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.

trm42 and others added 3 commits January 19, 2023 14:18
…output timestamp timezone with optional configuration key 'queue.log_timezone'
@taylorotwell taylorotwell merged commit 05546bf into laravel:9.x Jan 19, 2023
@trm42 trm42 deleted the queue-work-configurable-timestamp-timezone branch January 20, 2023 05:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants