Skip to content

Commit

Permalink
Merge pull request #25728 from mlutfy/core3438
Browse files Browse the repository at this point in the history
dev/core#3438 Drupal: Prevent cv fatal if logging before CMS bootstrap
  • Loading branch information
demeritcowboy authored Mar 3, 2023
2 parents 1f5f8b8 + 5e383d9 commit 4d13448
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CRM/Utils/System/Drupal8.php
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,10 @@ public function getDefaultBlockLocation() {
*/
public function logger($message, $priority = NULL) {
if (CRM_Core_Config::singleton()->userFrameworkLogging) {
// dev/core#3438 Prevent cv fatal if logging before CMS bootstrap
if (!class_exists('Drupal') || !\Drupal::hasContainer()) {
return;
}
\Drupal::logger('civicrm')->log($priority ?? \Drupal\Core\Logger\RfcLogLevel::DEBUG, '%message', ['%message' => $message]);
}
}
Expand Down

0 comments on commit 4d13448

Please sign in to comment.