diff --git a/logging.rst b/logging.rst index a4243b4c6dd..9e909f22a1a 100644 --- a/logging.rst +++ b/logging.rst @@ -338,6 +338,16 @@ option of your handler to ``rotating_file``: Using a Logger inside a Service ------------------------------- +If your application uses :ref:`service autoconfiguration `, +any service whose class implements ``Psr\Log\LoggerAwareInterface`` will +receive a call to its method ``setLogger()`` with the default logger service +passed as a service. + +.. versionadded:: 4.2 + + The automatic call to ``setLogger()`` when implementing ``LoggerAwareInterface`` + was introduced in Symfony 4.2. + If you want to use in your own services a pre-configured logger which uses a specific channel (``app`` by default), use the ``monolog.logger`` tag with the ``channel`` property as explained in the