======= Logging ======= .. sectionauthor:: Bernhard Posselt The logger is present by default in the container. The app that is logging is set automatically. Nextcloud uses a :ref:`PSR3 ` logger. The logger can be used in the following way: .. code-block:: php logger = $logger; $this->appName = $appName; } public function log($message) { $this->logger->error($message, ['extra_context' => 'my extra context']); } } In cases where you can not :ref:`inject ` a logger into a class, you can use the ``\OCP\Log\logger`` function to acquire a logger instance. As a first argument you need to pass the app ID. .. code-block:: php warning('look, no dependency injection');