1# Monolog - Logging for PHP [![Continuous Integration](https://github.com/Seldaek/monolog/workflows/Continuous%20Integration/badge.svg?branch=main)](https://github.com/Seldaek/monolog/actions)
4[![Latest Stable Version](https://img.shields.io/packagist/v/monolog/monolog.svg)](https://packagist.org/packages/monolog/monolog)
7Monolog sends your logs to files, sockets, inboxes, databases and various
8web services. See the complete list of handlers below. Special handlers
9allow you to build advanced logging strategies.
11This library implements the [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md)
12interface that you can type-hint against in your own libraries to keep
13a maximum of interoperability. You can also use it in your applications to
14make sure you can always use another compatible logger at a later time.
15As of 1.11.0 Monolog public APIs will also accept PSR-3 log levels.
16Internally Monolog still uses its own level scheme since it predates PSR-3.
20Install the latest version with
23$ composer require monolog/monolog
26## Basic Usage
34// create a log channel
35$log = new Logger('name');
36$log->pushHandler(new StreamHandler('path/to/your.log', Logger::WARNING));
38// add records to the log
45- [Usage Instructions](doc/01-usage.md)
46- [Handlers, Formatters and Processors](doc/02-handlers-formatters-processors.md)
47- [Utility Classes](doc/03-utilities.md)
48- [Extending Monolog](doc/04-extending.md)
49- [Log Record Structure](doc/message-structure.md)
51## Support Monolog Financially
53Get supported Monolog and help fund the project with the [Tidelift Subscription](https://tidelift.com/subscription/pkg/packagist-monolog-monolog?utm_source=packagist-monolog-monolog&utm_medium=referral&utm_campaign=enterprise) or via [GitHub sponsorship](https://github.com/sponsors/Seldaek).
55Tidelift delivers commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use.
57## Third Party Packages
59Third party handlers, formatters and processors are
60[listed in the wiki](https://github.com/Seldaek/monolog/wiki/Third-Party-Packages). You
61can also add your own there if you publish one.
67- Monolog `^2.0` works with PHP 7.2 or above, use Monolog `^1.25` for PHP 5.3+ support.
71Monolog 1.x support is somewhat limited at this point and only important fixes will be done. You should migrate to Monolog 2 where possible to benefit from all the latest features and fixes.
73### Submitting bugs and feature requests
75Bugs and feature request are tracked on [GitHub](https://github.com/Seldaek/monolog/issues)
77### Framework Integrations
79- Frameworks and libraries using [PSR-3](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md)
80 can be used very easily with Monolog since it implements the interface.
81- [Symfony](http://symfony.com) comes out of the box with Monolog.
82- [Laravel](http://laravel.com/) comes out of the box with Monolog.
83- [Lumen](http://lumen.laravel.com/) comes out of the box with Monolog.
84- [PPI](https://github.com/ppi/framework) comes out of the box with Monolog.
85- [CakePHP](http://cakephp.org/) is usable with Monolog via the [cakephp-monolog](https://github.com/jadb/cakephp-monolog) plugin.
86- [Slim](http://www.slimframework.com/) is usable with Monolog via the [Slim-Monolog](https://github.com/Flynsarmy/Slim-Monolog) log writer.
87- [XOOPS 2.6](http://xoops.org/) comes out of the box with Monolog.
88- [Aura.Web_Project](https://github.com/auraphp/Aura.Web_Project) comes out of the box with Monolog.
89- [Nette Framework](http://nette.org/en/) is usable with Monolog via the [contributte/monolog](https://github.com/contributte/monolog) or [orisai/nette-monolog](https://github.com/orisai/nette-monolog) extensions.
90- [Proton Micro Framework](https://github.com/alexbilbie/Proton) comes out of the box with Monolog.
91- [FuelPHP](http://fuelphp.com/) comes out of the box with Monolog.
92- [Equip Framework](https://github.com/equip/framework) comes out of the box with Monolog.
93- [Yii 2](http://www.yiiframework.com/) is usable with Monolog via the [yii2-monolog](https://github.com/merorafael/yii2-monolog) or [yii2-psr-log-target](https://github.com/samdark/yii2-psr-log-target) plugins.
94- [Hawkbit Micro Framework](https://github.com/HawkBitPhp/hawkbit) comes out of the box with Monolog.
95- [SilverStripe 4](https://www.silverstripe.org/) comes out of the box with Monolog.
96- [Drupal](https://www.drupal.org/) is usable with Monolog via the [monolog](https://www.drupal.org/project/monolog) module.
97- [Aimeos ecommerce framework](https://aimeos.org/) is usable with Monolog via the [ai-monolog](https://github.com/aimeos/ai-monolog) extension.
98- [Magento](https://magento.com/) comes out of the box with Monolog.
102Jordi Boggiano - <email@example.com> - <http://twitter.com/seldaek><br />
103See also the list of [contributors](https://github.com/Seldaek/monolog/contributors) who participated in this project.
107Monolog is licensed under the MIT License - see the [LICENSE](LICENSE) file for details
111This library is heavily inspired by Python's [Logbook](https://logbook.readthedocs.io/en/stable/)
112library, although most concepts have been adjusted to fit to the PHP world.