Skip to content

Commit 6ed1e77

Browse files
committed
feature #387 Use "use_locking" option with rotating file handler as well (HypeMC)
This PR was merged into the 3.x-dev branch. Discussion ---------- Use "use_locking" option with rotating file handler as well Fixes #382 . Commits ------- 1e3a6a0 Use "use_locking" option with rotating fie handler as well
2 parents 09ebbd8 + 1e3a6a0 commit 6ed1e77

File tree

4 files changed

+5
-3
lines changed

4 files changed

+5
-3
lines changed

DependencyInjection/Configuration.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
* - [level]: level name or int value, defaults to DEBUG
6464
* - [bubble]: bool, defaults to true
6565
* - [file_permission]: string|null, defaults to null
66+
* - [use_locking]: bool, defaults to false
6667
* - [filename_format]: string, defaults to '{filename}-{date}'
6768
* - [date_format]: string, defaults to 'Y-m-d'
6869
*
@@ -397,7 +398,7 @@ public function getConfigTreeBuilder()
397398
})
398399
->end()
399400
->end()
400-
->booleanNode('use_locking')->defaultFalse()->end() // stream
401+
->booleanNode('use_locking')->defaultFalse()->end() // stream and rotating
401402
->scalarNode('filename_format')->defaultValue('{filename}-{date}')->end() //rotating
402403
->scalarNode('date_format')->defaultValue('Y-m-d')->end() //rotating
403404
->scalarNode('ident')->defaultFalse()->end() // syslog and syslogudp

DependencyInjection/MonologExtension.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -389,6 +389,7 @@ private function buildHandler(ContainerBuilder $container, $name, array $handler
389389
$handler['level'],
390390
$handler['bubble'],
391391
$handler['file_permission'],
392+
$handler['use_locking'],
392393
]);
393394
$definition->addMethodCall('setFilenameFormat', [
394395
$handler['filename_format'],

Tests/DependencyInjection/ConfigurationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ public function testWithUseLocking()
334334
'use_locking' => false,
335335
],
336336
'bar' => [
337-
'type' => 'stream',
337+
'type' => 'rotating_file',
338338
'path' => '/bar',
339339
'use_locking' => true,
340340
]

Tests/DependencyInjection/FixtureMonologExtensionTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public function testLoadWithNewAndPriority()
159159

160160
$handler = $container->getDefinition('monolog.handler.first');
161161
$this->assertDICDefinitionClass($handler, 'Monolog\Handler\RotatingFileHandler');
162-
$this->assertDICConstructorArguments($handler, ['/tmp/monolog.log', 0, \Monolog\Logger::ERROR, true, null]);
162+
$this->assertDICConstructorArguments($handler, ['/tmp/monolog.log', 0, \Monolog\Logger::ERROR, true, null, false]);
163163

164164
$handler = $container->getDefinition('monolog.handler.last');
165165
$this->assertDICDefinitionClass($handler, 'Monolog\Handler\StreamHandler');

0 commit comments

Comments
 (0)