Skip to content

Commit 2387f9b

Browse files
committed
Configure streaming logs
1 parent 19366c5 commit 2387f9b

2 files changed

Lines changed: 14 additions & 1 deletion

File tree

ProcessMaker/Multitenancy/SwitchTenant.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ private function overrideConfigs(Application $app, IsTenant $tenant)
137137
$app->make('log')->reset();
138138
$app->forgetInstance('log');
139139

140+
// Used for setting the tenantId context when streaming logs to Loki
141+
$app->afterResolving('log', function ($log) use ($tenant) {
142+
$log->shareContext(['tenantId' => $tenant->id, 'appUrl' => $tenant->config['app.url']]);
143+
});
144+
140145
// url() helper
141146
app(UrlGenerator::class)->useOrigin($tenant->config['app.url']);
142147

config/logging.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,10 @@
3131
|
3232
*/
3333

34-
'deprecations' => env('LOG_DEPRECATIONS_CHANNEL', 'null'),
34+
'deprecations' => [
35+
'channel' => 'deprecations',
36+
'trace' => false,
37+
],
3538

3639
/*
3740
|--------------------------------------------------------------------------
@@ -135,6 +138,11 @@
135138
'level' => 'debug',
136139
'days' => env('DATA_SOURCE_CLEAR_LOG', 7),
137140
],
141+
'deprecations' => [
142+
'driver' => 'monolog',
143+
'handler' => NullHandler::class,
144+
'level' => 'emergency',
145+
],
138146
],
139147

140148
];

0 commit comments

Comments
 (0)