Skip to content

Commit 31fd0db

Browse files
committed
Added a note about the rotating_file monolog handler
1 parent fbdc177 commit 31fd0db

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

cookbook/logging/monolog.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,21 @@ only for a specific handler.
236236
generate hundreds of log lines. Consider using tools like the `logrotate`_
237237
Linux command to rotate log files before they become a problem.
238238

239+
In case you cannot use a dedicated tool for rotating log files, consider using
240+
the special ``rotating_file`` handler defined by Monolog. This handler creates
241+
a new log file every day and can also remove old files automatically. To use
242+
it, just set the ``type`` option of your handler to ``rotating_file``:
243+
244+
.. code-block:: yaml
245+
246+
# app/config/config_dev.yml
247+
monolog:
248+
handlers:
249+
main:
250+
type: rotating_file # <-- this value is usually 'stream'
251+
path: %kernel.logs_dir%/%kernel.environment%.log
252+
level: debug
253+
239254
A processor is simply a callable receiving the record as its first argument.
240255
Processors are configured using the ``monolog.processor`` DIC tag. See the
241256
:ref:`reference about it <dic_tags-monolog-processor>`.

0 commit comments

Comments
 (0)