Skip to content

[Logger] Update the location of prod logs #15852

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

Merged
merged 1 commit into from
Sep 25, 2021
Merged
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
15 changes: 9 additions & 6 deletions logging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,15 @@ The following sections assume that Monolog is installed.
Where Logs are Stored
---------------------

By default, log entries are written to the ``var/log/dev.log`` file when you're in
the ``dev`` environment. In the ``prod`` environment, logs are written to ``var/log/prod.log``,
but *only* during a request where an error or high-priority log entry was made
(i.e. ``error()`` , ``critical()``, ``alert()`` or ``emergency()``).
By default, log entries are written to the ``var/log/dev.log`` file when you're
in the ``dev`` environment.

To control this, you'll configure different *handlers* that handle log entries, sometimes
modify them, and ultimately store them.
In the ``prod`` environment, logs are written to `STDERR PHP stream`_, which
works best in modern containerized applications deployed to servers without
disk write permissions.

If you prefer to store production logs in a file, set the ``path`` of your
log handler(s) to the path of the file to use (e.g. ``var/log/prod.log``).

Handlers: Writing Logs to different Locations
---------------------------------------------
Expand Down Expand Up @@ -384,3 +386,4 @@ Learn more
.. _LoggerInterface: https://github.com/php-fig/log/blob/master/Psr/Log/LoggerInterface.php
.. _`logrotate`: https://github.com/logrotate/logrotate
.. _`Monolog Configuration`: https://github.com/symfony/monolog-bundle/blob/master/DependencyInjection/Configuration.php#L25
.. _`STDERR PHP stream`: https://www.php.net/manual/en/features.commandline.io-streams.php