maxbanton / cwh

Amazon Web Services CloudWatch Logs Handler for Monolog library
MIT License
417 stars 84 forks source link

Incompatible with most recent Monolog version? PHP Fatal Error with getDefaultFormatter() #49

Closed dustinbolton closed 6 years ago

dustinbolton commented 6 years ago
maxbanton commented 6 years ago

Hi @dustinbolton. Can not reproduce described issue. Do you use any framework? Could you show your handler configuration?

dustinbolton commented 6 years ago

I narrowed down the problem to being related to using my own autoloader rather than composer. I'm not using a framework but using an autoloader as suggested in https://github.com/Seldaek/monolog/issues/265

I was able to get this to work by modifying your CloudWatch.php as follows to make the function match more exactly. Do you think this is an acceptable fix?

Inserted at line 9: use Monolog\Formatter\FormatterInterface;

Changed line 331 from: protected function getDefaultFormatter() to protected function getDefaultFormatter(): FormatterInterface

maxbanton commented 6 years ago

Hi @dustinbolton! This kind of change will make Handler incompatible with PHP versions lower then 7.0 and it is unacceptable for now. PHP 5.6 is still used by 16% of packagist.org users. I plan to drop old PHP version support by the end of the year.

Max.