Browse Source

Merge remote branch 'stof/monolog_bubbling'

* stof/monolog_bubbling:
  [MonologBundle] Changed the default bubbling behavior. Fixes #1268
Fabien Potencier 14 years ago
parent
commit
f857ad2a31

+ 10 - 7
UPDATE.md

@@ -9,6 +9,9 @@ timeline closely anyway.
 beta4 to beta5
 beta4 to beta5
 --------------
 --------------
 
 
+* The stack of Monolog handlers now bubbles the records by default. To stop
+  the propagation you need to configure the bubbling explicitly.
+
 * Expanded the SerializerInterface, while reducing the number of public
 * Expanded the SerializerInterface, while reducing the number of public
   methods in the Serializer class itself breaking BC and adding component
   methods in the Serializer class itself breaking BC and adding component
   specific Exception classes.
   specific Exception classes.
@@ -155,16 +158,16 @@ beta2 to beta3
 * The settings under `framework.annotations` have changed slightly:
 * The settings under `framework.annotations` have changed slightly:
 
 
     Before:
     Before:
-  
+
         framework:
         framework:
             annotations:
             annotations:
                 cache: file
                 cache: file
                 file_cache:
                 file_cache:
                     debug: true
                     debug: true
                     dir: /foo
                     dir: /foo
-                
+
     After:
     After:
-     
+
         framework:
         framework:
             annotations:
             annotations:
                 cache: file
                 cache: file
@@ -275,7 +278,7 @@ class AcmeEntity
 }
 }
 ```
 ```
 
 
-* The config under `framework.validation.annotations` has been removed and was 
+* The config under `framework.validation.annotations` has been removed and was
   replaced with a boolean flag `framework.validation.enable_annotations` which
   replaced with a boolean flag `framework.validation.enable_annotations` which
   defaults to false.
   defaults to false.
 
 
@@ -422,7 +425,7 @@ class AcmeEntity
             'allow_add' => true,
             'allow_add' => true,
             'allow_delete' => true,
             'allow_delete' => true,
         ));
         ));
-      
+
 * `Request::hasSession()` has been renamed to `Request::hasPreviousSession()`. The
 * `Request::hasSession()` has been renamed to `Request::hasPreviousSession()`. The
   method `hasSession()` still exists, but only checks if the request contains a
   method `hasSession()` still exists, but only checks if the request contains a
   session object, not if the session was started in a previous request.
   session object, not if the session was started in a previous request.
@@ -438,10 +441,10 @@ class AcmeEntity
 
 
 * Serializer: The `$properties` argument has been dropped from all interfaces.
 * Serializer: The `$properties` argument has been dropped from all interfaces.
 
 
-* Form: Renamed option value `text` of `widget` option of the `date` type was 
+* Form: Renamed option value `text` of `widget` option of the `date` type was
   renamed to `single-text`. `text` indicates to use separate text boxes now
   renamed to `single-text`. `text` indicates to use separate text boxes now
   (like for the `time` type).
   (like for the `time` type).
-  
+
 * Form: Renamed view variable `name` to `full_name`. The variable `name` now
 * Form: Renamed view variable `name` to `full_name`. The variable `name` now
   contains the local, short name (equivalent to `$form->getName()`).
   contains the local, short name (equivalent to `$form->getName()`).
 
 

+ 1 - 1
src/Symfony/Bundle/MonologBundle/DependencyInjection/Configuration.php

@@ -57,7 +57,7 @@ class Configuration implements ConfigurationInterface
                             ->scalarNode('id')->end()
                             ->scalarNode('id')->end()
                             ->scalarNode('priority')->defaultValue(0)->end()
                             ->scalarNode('priority')->defaultValue(0)->end()
                             ->scalarNode('level')->defaultValue('DEBUG')->end()
                             ->scalarNode('level')->defaultValue('DEBUG')->end()
-                            ->booleanNode('bubble')->defaultFalse()->end()
+                            ->booleanNode('bubble')->defaultTrue()->end()
                             ->scalarNode('path')->defaultValue('%kernel.logs_dir%/%kernel.environment%.log')->end() // stream and rotating
                             ->scalarNode('path')->defaultValue('%kernel.logs_dir%/%kernel.environment%.log')->end() // stream and rotating
                             ->scalarNode('ident')->defaultFalse()->end() // syslog
                             ->scalarNode('ident')->defaultFalse()->end() // syslog
                             ->scalarNode('facility')->defaultValue('user')->end() // syslog
                             ->scalarNode('facility')->defaultValue('user')->end() // syslog

+ 10 - 10
src/Symfony/Bundle/MonologBundle/Tests/DependencyInjection/MonologExtensionTest.php

@@ -32,7 +32,7 @@ class MonologExtensionTest extends TestCase
 
 
         $handler = $container->getDefinition('monolog.handler.main');
         $handler = $container->getDefinition('monolog.handler.main');
         $this->assertDICDefinitionClass($handler, '%monolog.handler.stream.class%');
         $this->assertDICDefinitionClass($handler, '%monolog.handler.stream.class%');
-        $this->assertDICConstructorArguments($handler, array('%kernel.logs_dir%/%kernel.environment%.log', \Monolog\Logger::DEBUG, false));
+        $this->assertDICConstructorArguments($handler, array('%kernel.logs_dir%/%kernel.environment%.log', \Monolog\Logger::DEBUG, true));
     }
     }
 
 
     public function testLoadWithCustomValues()
     public function testLoadWithCustomValues()
@@ -40,7 +40,7 @@ class MonologExtensionTest extends TestCase
         $container = new ContainerBuilder();
         $container = new ContainerBuilder();
         $loader = new MonologExtension();
         $loader = new MonologExtension();
 
 
-        $loader->load(array(array('handlers' => array('custom' => array('type' => 'stream', 'path' => '/tmp/symfony.log', 'bubble' => true, 'level' => 'ERROR')))), $container);
+        $loader->load(array(array('handlers' => array('custom' => array('type' => 'stream', 'path' => '/tmp/symfony.log', 'bubble' => false, 'level' => 'ERROR')))), $container);
         $this->assertTrue($container->hasDefinition('monolog.logger'));
         $this->assertTrue($container->hasDefinition('monolog.logger'));
         $this->assertTrue($container->hasDefinition('monolog.handler.custom'));
         $this->assertTrue($container->hasDefinition('monolog.handler.custom'));
 
 
@@ -49,7 +49,7 @@ class MonologExtensionTest extends TestCase
 
 
         $handler = $container->getDefinition('monolog.handler.custom');
         $handler = $container->getDefinition('monolog.handler.custom');
         $this->assertDICDefinitionClass($handler, '%monolog.handler.stream.class%');
         $this->assertDICDefinitionClass($handler, '%monolog.handler.stream.class%');
-        $this->assertDICConstructorArguments($handler, array('/tmp/symfony.log', \Monolog\Logger::ERROR, true));
+        $this->assertDICConstructorArguments($handler, array('/tmp/symfony.log', \Monolog\Logger::ERROR, false));
     }
     }
 
 
     public function testLoadWithSeveralHandlers()
     public function testLoadWithSeveralHandlers()
@@ -58,7 +58,7 @@ class MonologExtensionTest extends TestCase
         $loader = new MonologExtension();
         $loader = new MonologExtension();
 
 
         $loader->load(array(array('handlers' => array(
         $loader->load(array(array('handlers' => array(
-            'custom' => array('type' => 'stream', 'path' => '/tmp/symfony.log', 'bubble' => true, 'level' => 'ERROR'),
+            'custom' => array('type' => 'stream', 'path' => '/tmp/symfony.log', 'bubble' => false, 'level' => 'ERROR'),
             'main' => array('type' => 'fingers_crossed', 'action_level' => 'ERROR', 'handler' => 'nested'),
             'main' => array('type' => 'fingers_crossed', 'action_level' => 'ERROR', 'handler' => 'nested'),
             'nested' => array('type' => 'stream')
             'nested' => array('type' => 'stream')
         ))), $container);
         ))), $container);
@@ -73,11 +73,11 @@ class MonologExtensionTest extends TestCase
 
 
         $handler = $container->getDefinition('monolog.handler.custom');
         $handler = $container->getDefinition('monolog.handler.custom');
         $this->assertDICDefinitionClass($handler, '%monolog.handler.stream.class%');
         $this->assertDICDefinitionClass($handler, '%monolog.handler.stream.class%');
-        $this->assertDICConstructorArguments($handler, array('/tmp/symfony.log', \Monolog\Logger::ERROR, true));
+        $this->assertDICConstructorArguments($handler, array('/tmp/symfony.log', \Monolog\Logger::ERROR, false));
 
 
         $handler = $container->getDefinition('monolog.handler.main');
         $handler = $container->getDefinition('monolog.handler.main');
         $this->assertDICDefinitionClass($handler, '%monolog.handler.fingers_crossed.class%');
         $this->assertDICDefinitionClass($handler, '%monolog.handler.fingers_crossed.class%');
-        $this->assertDICConstructorArguments($handler, array(new Reference('monolog.handler.nested'), \Monolog\Logger::ERROR, 0, false, true));
+        $this->assertDICConstructorArguments($handler, array(new Reference('monolog.handler.nested'), \Monolog\Logger::ERROR, 0, true, true));
     }
     }
 
 
     public function testLoadWithOverwriting()
     public function testLoadWithOverwriting()
@@ -87,7 +87,7 @@ class MonologExtensionTest extends TestCase
 
 
         $loader->load(array(
         $loader->load(array(
             array('handlers' => array(
             array('handlers' => array(
-                'custom' => array('type' => 'stream', 'path' => '/tmp/symfony.log', 'bubble' => true, 'level' => 'ERROR'),
+                'custom' => array('type' => 'stream', 'path' => '/tmp/symfony.log', 'bubble' => false, 'level' => 'ERROR'),
                 'main' => array('type' => 'fingers_crossed', 'action_level' => 'ERROR', 'handler' => 'nested'),
                 'main' => array('type' => 'fingers_crossed', 'action_level' => 'ERROR', 'handler' => 'nested'),
                 'nested' => array('type' => 'stream')
                 'nested' => array('type' => 'stream')
             )),
             )),
@@ -110,7 +110,7 @@ class MonologExtensionTest extends TestCase
 
 
         $handler = $container->getDefinition('monolog.handler.main');
         $handler = $container->getDefinition('monolog.handler.main');
         $this->assertDICDefinitionClass($handler, '%monolog.handler.fingers_crossed.class%');
         $this->assertDICDefinitionClass($handler, '%monolog.handler.fingers_crossed.class%');
-        $this->assertDICConstructorArguments($handler, array(new Reference('monolog.handler.nested'), \Monolog\Logger::ERROR, 0, false, true));
+        $this->assertDICConstructorArguments($handler, array(new Reference('monolog.handler.nested'), \Monolog\Logger::ERROR, 0, true, true));
     }
     }
 
 
     public function testLoadWithNewAtEnd()
     public function testLoadWithNewAtEnd()
@@ -125,7 +125,7 @@ class MonologExtensionTest extends TestCase
                 'nested' => array('type' => 'stream')
                 'nested' => array('type' => 'stream')
             )),
             )),
             array('handlers' => array(
             array('handlers' => array(
-                'custom' => array('type' => 'stream', 'path' => '/tmp/symfony.log', 'bubble' => true, 'level' => 'WARNING'),
+                'custom' => array('type' => 'stream', 'path' => '/tmp/symfony.log', 'bubble' => false, 'level' => 'WARNING'),
                 'new' => array('type' => 'stream', 'path' => '/tmp/monolog.log', 'bubble' => true, 'level' => 'ERROR'),
                 'new' => array('type' => 'stream', 'path' => '/tmp/monolog.log', 'bubble' => true, 'level' => 'ERROR'),
             ))
             ))
         ), $container);
         ), $container);
@@ -177,7 +177,7 @@ class MonologExtensionTest extends TestCase
 
 
         $handler = $container->getDefinition('monolog.handler.main');
         $handler = $container->getDefinition('monolog.handler.main');
         $this->assertDICDefinitionClass($handler, '%monolog.handler.buffer.class%');
         $this->assertDICDefinitionClass($handler, '%monolog.handler.buffer.class%');
-        $this->assertDICConstructorArguments($handler, array(new Reference('monolog.handler.nested'), 0, \Monolog\Logger::INFO, false));
+        $this->assertDICConstructorArguments($handler, array(new Reference('monolog.handler.nested'), 0, \Monolog\Logger::INFO, true));
 
 
         $handler = $container->getDefinition('monolog.handler.first');
         $handler = $container->getDefinition('monolog.handler.first');
         $this->assertDICDefinitionClass($handler, '%monolog.handler.rotating_file.class%');
         $this->assertDICDefinitionClass($handler, '%monolog.handler.rotating_file.class%');