diff --git a/ProcessMaker/Multitenancy/SwitchTenant.php b/ProcessMaker/Multitenancy/SwitchTenant.php index e522798a8c..f7740ddcbf 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'])) {