From ac147413fd983913529228be08fd81a72de61033 Mon Sep 17 00:00:00 2001 From: Nolan Ehrstrom Date: Wed, 17 Sep 2025 12:43:07 -0700 Subject: [PATCH] Use simple log file switching for tenants --- ProcessMaker/Multitenancy/SwitchTenant.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ProcessMaker/Multitenancy/SwitchTenant.php b/ProcessMaker/Multitenancy/SwitchTenant.php index f5c0d16bb0..cefadd65e0 100644 --- a/ProcessMaker/Multitenancy/SwitchTenant.php +++ b/ProcessMaker/Multitenancy/SwitchTenant.php @@ -8,6 +8,7 @@ use Illuminate\Database\Eloquent\Model; use Illuminate\Support\Facades\Crypt; use Illuminate\Support\Facades\DB; +use Monolog\Handler\RotatingFileHandler; use ProcessMaker\Multitenancy\Broadcasting\TenantAwareBroadcastManager; use ProcessMaker\Multitenancy\TenantAwareDispatcher; use Spatie\Multitenancy\Concerns\UsesMultitenancyConfig; @@ -104,6 +105,15 @@ public function makeCurrent(IsTenant $tenant): void config($newConfig); + // Put tenant logs in their own files + $app->make('log') + ->driver('daily') + ->getHandlers()[0] + ->setFileNameFormat( + '{filename}-tenant_' . $tenant->id . '-{date}', + RotatingFileHandler::FILE_PER_DAY + ); + // Set config from the entry in the tenants table $config = $tenant->config; if (isset($config['app.key'])) {