8000 Documented the LoggerAwareInterface autoconfiguration by javiereguiluz · Pull Request #11438 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Documented the LoggerAwareInterface autoconfiguration #11438

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions logging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,16 @@ option of your handler to ``rotating_file``:
Using a Logger inside a Service
-------------------------------

If your application uses :ref:`service autoconfiguration <services-autoconfigure>`,
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
Expand Down
0