Skip to content

How to Disable Microseconds Precision (for a Performance Boost)

Warning: You are browsing the documentation for Symfony 3.x, which is no longer maintained.

Consider upgrading your projects to Symfony 7.1.

Setting the parameter use_microseconds to false forces the logger to reduce the precision in the datetime field of the log messages from microsecond to second, avoiding a call to the microtime(true) function and the subsequent parsing. Disabling the use of microseconds can provide a small performance gain speeding up the log generation. This is recommended for systems that generate a large number of log events.

1
2
3
4
5
6
7
8
# app/config/config.yml
monolog:
    use_microseconds: false
    handlers:
        applog:
            type: stream
            path: /var/log/symfony.log
            level: error
This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.
TOC
    Version