Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit b9c7139

Browse filesBrowse files
phansysjaviereguiluz
authored andcommitted
[Logging] Add references to the ConsoleLogger
1 parent 35df8ae commit b9c7139
Copy full SHA for b9c7139

File tree

Expand file treeCollapse file tree

1 file changed

+13
-6
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+13
-6
lines changed

‎logging.rst

Copy file name to clipboardExpand all lines: logging.rst
+13-6Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
Logging
22
=======
33

4-
Symfony comes with a minimalist `PSR-3`_ logger: :class:`Symfony\\Component\\HttpKernel\\Log\\Logger`.
5-
In conformance with `the twelve-factor app methodology`_, it sends messages starting from the
4+
Symfony comes with two minimalist `PSR-3`_ loggers: :class:`Symfony\\Component\\HttpKernel\\Log\\Logger`
5+
for the HTTP context and :class:`Symfony\\Component\\Console\\Logger\\ConsoleLogger` for the
6+
CLI context.
7+
In conformance with `the twelve-factor app methodology`_, they send messages starting from the
68
``WARNING`` level to `stderr`_.
79

810
The minimal log level can be changed by setting the ``SHELL_VERBOSITY`` environment variable:
@@ -17,13 +19,18 @@ The minimal log level can be changed by setting the ``SHELL_VERBOSITY`` environm
1719
========================= =================
1820

1921
The minimum log level, the default output and the log format can also be changed by
20-
passing the appropriate arguments to the constructor of :class:`Symfony\\Component\\HttpKernel\\Log\\Logger`.
21-
To do so, :ref:`override the "logger" service definition <service-psr4-loader>`.
22+
passing the appropriate arguments to the constructor of :class:`Symfony\\Component\\HttpKernel\\Log\\Logger`
23+
and :class:`Symfony\\Component\\Console\\Logger\\ConsoleLogger`.
24+
25+
The :class:`Symfony\\Component\\HttpKernel\\Log\\Logger` class is available through the ``logger`` service.
26+
To pass your configuration, you can :ref:`override the "logger" service definition <service-psr4-loader>`.
27+
28+
For more information about ``ConsoleLogger``, see :doc:`/components/console/logger`.
2229

2330
Logging a Message
2431
-----------------
2532

26-
To log a message, inject the default logger in your controller or service::
33+
To log a message using the ``logger`` service, inject the default logger in your controller or service::
2734

2835
use Psr\Log\LoggerInterface;
2936
// ...
@@ -55,7 +62,7 @@ Adding placeholders to log messages is recommended because:
5562
* It's better for security, because escaping can then be done by the
5663
implementation in a context-aware fashion.
5764

58-
The ``logger`` service has different methods for different logging levels/priorities.
65+
The logger implementations has different methods for different logging levels/priorities.
5966
See `LoggerInterface`_ for a list of all of the methods on the logger.
6067

6168
Monolog

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.