Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commit3d98b28

Browse files
committed
feature#6583 Adding a description for the use_microseconds parameter introduced in MonologBundle v2.11 (jorgelbg)
This PR was squashed before being merged into the 2.3 branch (closes#6583).Discussion----------Adding a description for the use_microseconds parameter introduced in MonologBundle v2.11This adds a small paragraph bellow the usage section with an explanation and an example block.| Q | A| ------------- | ---| Doc fix? | yes| New docs? | no| Applies to | >= 2.3| Fixed tickets |#6466Commits-------4c5d42f Adding a description for the use_microseconds parameter introduced in MonologBundle v2.11
2 parents5bdb6d3 +4c5d42f commit3d98b28

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

‎cookbook/logging/monolog.rst‎

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,67 @@ option of your handler to ``rotating_file``:
289289
),
290290
));
291291
292+
How to Disable Microseconds Precision
293+
-------------------------------------
294+
295+
..versionadded::2.11
296+
The ``use_microseconds`` option was introduced in MonologBundle 2.11.
297+
298+
Setting the parameter ``use_microseconds`` to ``false`` forces the logger to reduce
299+
the precision in the ``datetime`` field of the log messages from microsecond to second,
300+
avoiding a call to the ``microtime(true)`` function and the subsequent parsing.
301+
Disabling the use of microseconds can provide a small performance gain speeding up the
302+
log generation. This is recommended for systems that generate a large number of log events.
303+
304+
..configuration-block::
305+
306+
..code-block::yaml
307+
308+
# app/config/config.yml
309+
monolog:
310+
use_microseconds:false
311+
handlers:
312+
applog:
313+
type:stream
314+
path:/var/log/symfony.log
315+
level:error
316+
317+
..code-block::xml
318+
319+
<!-- app/config/config.xml-->
320+
<?xml version="1.0" encoding="UTF-8" ?>
321+
<containerxmlns="http://symfony.com/schema/dic/services"
322+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
323+
xmlns:monolog="http://symfony.com/schema/dic/monolog"
324+
xsi:schemaLocation="http://symfony.com/schema/dic/services
325+
http://symfony.com/schema/dic/services/services-1.0.xsd
326+
http://symfony.com/schema/dic/monolog
327+
http://symfony.com/schema/dic/monolog/monolog-1.0.xsd">
328+
329+
<monolog:configuse_microseconds="false">
330+
<monolog:handler
331+
name="applog"
332+
type="stream"
333+
path="/var/log/symfony.log"
334+
level="error"
335+
/>
336+
</monolog:config>
337+
</container>
338+
339+
..code-block::php
340+
341+
// app/config/config.php
342+
$container->loadFromExtension('monolog', array(
343+
'use_microseconds' => false,
344+
'handlers' => array(
345+
'applog' => array(
346+
'type' => 'stream',
347+
'path' => '/var/log/symfony.log',
348+
'level' => 'error',
349+
),
350+
),
351+
));
352+
292353
Adding some extra Data in the Log Messages
293354
------------------------------------------
294355

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp