From ad2cbf936a69a75085778008a7272335509529f1 Mon Sep 17 00:00:00 2001 From: yashodha Date: Thu, 3 Nov 2022 18:34:26 +0530 Subject: [PATCH] (dev/core#3136) Incorporate the domain id in the log file nomenclature to help locate the file easily --- CRM/Core/Error.php | 2 +- tests/phpunit/CRM/Core/ErrorTest.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CRM/Core/Error.php b/CRM/Core/Error.php index ed22b19bb5..bb39511f4a 100644 --- a/CRM/Core/Error.php +++ b/CRM/Core/Error.php @@ -689,7 +689,7 @@ class CRM_Core_Error extends PEAR_ErrorStack { else { $hash = ''; } - $fileName = $config->configAndLogDir . 'CiviCRM.' . $prefixString . $hash . 'log'; + $fileName = $config->configAndLogDir . 'CiviCRM.' . CIVICRM_DOMAIN_ID . '_' . $prefixString . $hash . 'log'; // Roll log file monthly or if greater than our threshold. // Size-based rotation introduced in response to filesize limits on diff --git a/tests/phpunit/CRM/Core/ErrorTest.php b/tests/phpunit/CRM/Core/ErrorTest.php index f183348de4..9daaa2fd35 100644 --- a/tests/phpunit/CRM/Core/ErrorTest.php +++ b/tests/phpunit/CRM/Core/ErrorTest.php @@ -100,7 +100,7 @@ class CRM_Core_ErrorTest extends CiviUnitTestCase { $log->log('Little lamb'); $config = CRM_Core_Config::singleton(); $fileContents = file_get_contents($log->_filename); - $this->assertEquals($config->configAndLogDir . 'CiviCRM.' . 'my-test.' . CRM_Core_Error::generateLogFileHash($config) . '.log', $log->_filename); + $this->assertEquals($config->configAndLogDir . 'CiviCRM.' . CIVICRM_DOMAIN_ID . '_' . 'my-test.' . CRM_Core_Error::generateLogFileHash($config) . '.log', $log->_filename); // The 5 here is a bit arbitrary - on my local the date part is 15 chars (Mar 29 05:29:16) - but we are just checking that // there are chars for the date at the start. $this->assertTrue(strpos($fileContents, '[info] Mary had a little lamb') > 10); -- 2.25.1