@@ -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+ <container xmlns =" 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 : config use_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