aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/Log.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/Log.php')
-rw-r--r--lib/private/Log.php9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/private/Log.php b/lib/private/Log.php
index 746e4d75b91..0787483e8f2 100644
--- a/lib/private/Log.php
+++ b/lib/private/Log.php
@@ -15,11 +15,13 @@ use OC\Log\ExceptionSerializer;
use OCP\EventDispatcher\IEventDispatcher;
use OCP\ILogger;
use OCP\IRequest;
+use OCP\ISession;
use OCP\IUserSession;
use OCP\Log\BeforeMessageLoggedEvent;
use OCP\Log\IDataLogger;
use OCP\Log\IFileBased;
use OCP\Log\IWriter;
+use OCP\Session\Exceptions\SessionNotAvailableException;
use OCP\Support\CrashReport\IRegistry;
use Throwable;
use function array_merge;
@@ -170,6 +172,13 @@ class Log implements ILogger, IDataLogger {
if (!$hasBacktrace && $logBacktrace) {
$entry['backtrace'] = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
}
+ if ($this->config->getValue('log.sessionId', false)) {
+ try {
+ $entry['sessionId'] = \OCP\Server::get(ISession::class)->getId();
+ } catch (SessionNotAvailableException) {
+ $entry['sessionId'] = false;
+ }
+ }
try {
if ($level >= $minLevel) {