}
$file_log->close();
- if (!empty($config->userFrameworkLogging)) {
+ if (!isset(\Civi::$statics[__CLASS__]['userFrameworkLogging'])) {
+ // Set it to FALSE first & then try to set it. This is to prevent a loop as calling
+ // $config->userFrameworkLogging can trigger DB queries & under log mode this
+ // then gets called again.
+ \Civi::$statics[__CLASS__]['userFrameworkLogging'] = FALSE;
+ \Civi::$statics[__CLASS__]['userFrameworkLogging'] = $config->userFrameworkLogging;
+ }
+
+ if (!empty(\Civi::$statics[__CLASS__]['userFrameworkLogging'])) {
// should call $config->userSystem->logger($message) here - but I got a situation where userSystem was not an object - not sure why
if ($config->userSystem->is_drupal and function_exists('watchdog')) {
watchdog('civicrm', '%message', array('%message' => $message), WATCHDOG_DEBUG);