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

Remove an unneeded logging article #8770

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

Closed
wants to merge 5 commits into from
Closed
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Added block to main article.
  • Loading branch information
ricardodevries committed Nov 29, 2017
commit 2519c7af3d072680ea21a1ecf559af2ee1e2abb2
44 changes: 43 additions & 1 deletion 44 logging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,49 @@ specific channel (``app`` by default), use the ``monolog.logger`` tag with the
``channel`` property as explained in the
:ref:`Dependency Injection reference <dic_tags-monolog>`.

How to Disable Microseconds Precision (for a Performance Boost)
---------------------------------------------------------------

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.

.. configuration-block::

.. code-block:: yaml

# config/packages/monolog.yaml
monolog:
use_microseconds: false
# ...

.. code-block:: xml

<!-- config/packages/monolog.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:monolog="http://symfony.com/schema/dic/monolog"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/monolog
http://symfony.com/schema/dic/monolog/monolog-1.0.xsd">

<monolog:config use-microseconds="false">
<!-- ... -->
</monolog:config>
</container>

.. code-block:: php

// config/packages/monolog.php
$container->loadFromExtension('monolog', array(
'use_microseconds' => false,
// ...
));

Adding extra Data to each Log (e.g. a unique request token)
-----------------------------------------------------------

Expand All @@ -343,7 +386,6 @@ Learn more
logging/processors
logging/monolog_regex_based_excludes
logging/monolog_console
logging/disable_microsecond_precision

.. _Monolog: https://github.com/Seldaek/monolog
.. _LoggerInterface: https://github.com/php-fig/log/blob/master/Psr/Log/LoggerInterface.php
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.