Skip to content

Commit 0a5be4c

Browse files
committed
doc(loggin): add documentation for the enabled handler option
1 parent 3043867 commit 0a5be4c

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

logging.rst

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,25 @@ which they are defined:
250250

251251
.. _logging-handler-fingers_crossed:
252252

253+
254+
.. note::
255+
256+
You can use the ``enabled`` option to enable or disable a handler depending
257+
on the environment. For example, you can keep logging in ``dev`` and ``prod``
258+
but disable it in ``staging``:
259+
260+
.. code-block:: yaml
261+
262+
monolog:
263+
handlers:
264+
file_log:
265+
type: stream
266+
path: "%kernel.logs_dir%/%kernel.environment%.log"
267+
level: debug
268+
enabled: false # disables the handler
269+
270+
When ``enabled`` is set to ``false``, the handler is completely ignored.
271+
253272
Handlers that Modify Log Entries
254273
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
255274

0 commit comments

Comments
 (0)