Categories
symfony2

Monolog logs the WARN after ERR

I have “the luck” to work on an old Symfony2.0 application and today I had the following *@#&$*@ problem. Monolog logs the WARN level messages if I log before an ERR level message.

[php]
$logger = $this->get(‘logger’);
//$logger->err(‘RAZV err’);
$logger->warn(‘RAZV 1 warn’);
$logger->warn(‘RAZV 2 warn’);
die;
[/php]

In the logs:
[bash]tail -f log/*[/bash]

Nothing.

Same piece of code but with err logged:
[php]
$logger = $this->get(‘logger’);
$logger->err(‘RAZV err’);
$logger->warn(‘RAZV 1 warn’);
$logger->warn(‘RAZV 2 warn’);
die;
[/php]

In the logs:

[bash]tail -f log/*

==> log/prod.log <==
[2013-06-04 11:45:40] app.ERROR: RAZV err [] []
[2013-06-04 11:45:40] app.WARNING: RAZV 1 warn [] []
[2013-06-04 11:45:40] app.WARNING: RAZV 2 warn [] []
[/bash]

WTF!!!!