Commit cbb0b81
committed
feature #30339 [Monolog] Disable DebugLogger in CLI (lyrixx)
This PR was merged into the 4.3-dev branch.
Discussion
----------
[Monolog] Disable DebugLogger in CLI
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? | no
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? |
| Fixed tickets | #30333 symfony/monolog-bundle#165 #25876
| License | MIT
| Doc PR |
<details>
<summary>Considering this code:</summary>
```php
namespace App\Command;
use Psr\Log\LoggerInterface;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
class LeakCommand extends Command
{
protected static $defaultName = 'leak';
private $logger;
public function __construct(LoggerInterface $logger)
{
$this->logger = $logger;
parent::__construct();
}
protected function execute(InputInterface $input, OutputInterface $output)
{
$reportedAt = time();
while (true) {
$this->logger->info('Hello');
if (time() - $reportedAt >= 1) {
$output->writeln(sprintf('%dMb', memory_get_usage() / 1024 / 1024));
$reportedAt = time();
}
}
}
}
```
</details>
Without the patch
```
>…/dev/labs/symfony/website-skeleton(monolog %) bin/console leak
7Mb
28Mb
51Mb
76Mb
97Mb
````
With the patch
```
>…/dev/labs/symfony/website-skeleton(monolog %) bin/console leak
6Mb
6Mb
6Mb
6Mb
```
Commits
-------
17533da [Monolog] Disable DebugLogger in CLIFile tree
2 files changed
+23
-0
lines changed- src/Symfony
- Bridge/Monolog
- Bundle/FrameworkBundle/DependencyInjection/Compiler
2 files changed
+23
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
83 | 98 | | |
84 | 99 | | |
85 | 100 | | |
| |||
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
33 | 34 | | |
34 | 35 | | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
35 | 43 | | |
0 commit comments