MediaWiki now supports adding context fields to all log events within the current request. You can use
LoggerFactory::getContext()->->add( [ 'myCustomField' => ... ] );
to add a field to all subsequent logs in the request, or
$scope = LoggerFactory::getContext()->->addScoped( [ 'myCustomField' => ... ] );
to do it within a given scope.
For some of the existing usage, see https://gerrit.wikimedia.org/r/q/hashtag:%22global-logging-context%22 (For example, you can now filter Logstash to events logged in a specific job class with context_job_type, or a given special page with context_special_page_name.)
For more information, see https://phabricator.wikimedia.org/T142313
wikitech-l@lists.wikimedia.org