Skip to content

Commit ff448b6

Browse files
committed
minor #11438 Documented the LoggerAwareInterface autoconfiguration (javiereguiluz)
This PR was squashed before being merged into the 4.2 branch (closes #11438). Discussion ---------- Documented the LoggerAwareInterface autoconfiguration Fixes #10188. Commits ------- 7305bf0 Documented the LoggerAwareInterface autoconfiguration
2 parents 2dff31b + 7305bf0 commit ff448b6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

logging.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,16 @@ option of your handler to ``rotating_file``:
338338
Using a Logger inside a Service
339339
-------------------------------
340340

341+
If your application uses :ref:`service autoconfiguration <services-autoconfigure>`,
342+
any service whose class implements ``Psr\Log\LoggerAwareInterface`` will
343+
receive a call to its method ``setLogger()`` with the default logger service
344+
passed as a service.
345+
346+
.. versionadded:: 4.2
347+
348+
The automatic call to ``setLogger()`` when implementing ``LoggerAwareInterface``
349+
was introduced in Symfony 4.2.
350+
341351
If you want to use in your own services a pre-configured logger which uses a
342352
specific channel (``app`` by default), use the ``monolog.logger`` tag with the
343353
``channel`` property as explained in the

0 commit comments

Comments
 (0)