Monolog: handlers pick the destination, PSR-3 only guards the boundary
Sends your logs to files, sockets, inboxes, databases and various web services
At a glance
- What is it?
- Monolog is the PHP logging library that ships inside most frameworks, built around channels that you push handlers onto. Its public API accepts PSR-3 log levels while its internals keep Monolog's own scheme, its 1.x line no longer receives PHP support fixes, and five of the framework integrations in the README are usable only through third-party plugins or modules.
- Who is it for?
- Take Monolog if your framework already ships it or if you want the PSR-3 guarantee that a later swap to another logger will not break your library's call sites. Do not take it for a version you are about to drop, because 1.x no longer takes PHP support fixes, and do not read the wiki's third-party package list as a compatibility table.
- Can I use it commercially?
- Yes. MIT is a permissive licence: you can use, modify and sell software built on it, as long as you keep its copyright and licence notices.
- Is it still maintained?
- Yes. The repository last received commits 12 days ago.
- What is it written in?
- Mainly PHP, according to GitHub's language statistics.
Answers come from the project's GitHub data, last synced on November 13, 2026, and from our analysis. They are not legal advice.
Star history
- Seldaek/monolog21,404 ★ · +0
| Repository | 2026-09-21 | 2026-11-13 |
|---|---|---|
| Seldaek/monolog | 21.4k | 21.4k |
0 Stars in the last 53 days, measured from the daily GitHub snapshot. Compare with other projects
Editorial analysis
A channel does nothing until you push a handler onto it
The unit of work in Monolog is a channel, and a channel writes nowhere until a handler is pushed onto it. The basic example builds a Logger named name, then pushes a StreamHandler pointed at path/to/your.log whose second argument is Level::Warning:
<?php
use Monolog\Level;
use Monolog\Logger;
use Monolog\Handler\StreamHandler;
// create a log channel
$log = new Logger('name');
$log->pushHandler(new StreamHandler('path/to/your.log', Level::Warning));That second argument is a filter, so records below warning never reach the file, which is why the two calls that follow it, a warning and an error, both belong there. Two things follow from the same design. A destination is a PHP object your code constructs, with no config file and no environment variable in the snippet, and adding a second destination is another push rather than an edit to an ini. The rest lives in doc/, with usage in doc/01-usage.md and the catalogue in doc/02-handlers-formatters-processors.md.
PSR-3 levels are accepted at the API while the internals keep Monolog's own scheme
Monolog implements PSR-3 and the reason is stated plainly: you can type-hint the interface inside your own libraries so a different PSR-3 logger can be dropped in later. The level story is where that promise turns out to be asymmetric. As of 1.11.0 the public APIs also accept PSR-3 log levels, but internally Monolog still uses its own level scheme because it predates PSR-3. So the interoperability guarantee holds at the boundary of your calls, not inside the library's own comparisons. Plan on converting if you read Monolog's internals or compare level numbers yourself, and expect the constants in your code, Monolog\Level::Warning in the example above, to be the values the handlers actually compare against.
Three supported lines with three PHP floors, and 1.x has stopped taking PHP fixes
Monolog ^3.0 works with PHP 8.1 or above. Monolog ^2.5 works with PHP 7.2 or above. Monolog ^1.25 works with PHP 5.3 up to 8.1, and the project says it is not very maintained anymore and will not receive PHP support fixes anymore. The support section narrows that further: 1.x gets only important fixes, and the advice is to migrate to 2 or 3 where possible to get the latest features and fixes. The consequence lands on your runtime plan rather than on your code. On PHP 7.2 through 8.0, 3.x will not install and you are buying 2.x. Staying on 1.x to keep PHP 5.3 compatibility is a decision to live without PHP support fixes.
Half the framework list is plugins Monolog does not ship
The integration list is really two lists wearing one coat. Symfony, Laravel, Lumen, PPI, XOOPS 2.6, Aura.Web_Project, Proton, FuelPHP, Equip Framework, Hawkbit, SilverStripe 4, Magento, Spiral and WebFramework are described as coming out of the box with Monolog. CakePHP, Nette, Yii 2, Drupal and Aimeos are described as usable only through a named package: cakephp-monolog, contributte/monolog or orisai/nette-monolog, yii2-monolog or yii2-psr-log-target, the monolog module, and ai-monolog. The consequence is that part of that list is a dependency you adopt on someone else's release schedule, and nothing in the README says which Monolog major each of those packages supports. Check the plugin, not the framework, before you commit to it.
Three PHPStan baselines and a PHP-version-dependent ignore file
Static analysis here is arranged per PHP version rather than globally. The top level carries phpstan.neon.dist as the config, three baseline files named phpstan-baseline.neon, phpstan-baseline-8.2.neon and phpstan-baseline-pre-8.4.neon, and a file called phpstan-ignore-by-php-version.neon.php. The naming gives away the intent: one code base is analysed across the PHP versions it supports, and known findings are frozen into version-specific baselines so each of those runs can pass without the findings being cleaned once. The consequence for anyone judging quality is that a finding recorded in a baseline stays recorded, and the version-dependent ignore file means a rule can apply on one supported PHP and be suppressed on another. Style is handled apart from analysis, through .php-cs-fixer.php, and tests run from phpunit.xml.dist.
The handler catalogue and every third-party handler live in a wiki outside the repository
Monolog sends logs to files, sockets, inboxes, databases and various web services, and special handlers are what let you build advanced logging strategies. The built-in handlers are documented in doc/02-handlers-formatters-processors.md, while third-party handlers, formatters and processors are listed on the wiki's Third Party Packages page, which invites you to add your own if you publish one. Because that third-party list lives outside the versioned repository, check each package's own composer constraints against the Monolog major you installed.
Four releases in September, and two files that explain the jump
The release history is fast. The three most recent releases are 3.11.0 on 2026-09-02, 3.12.0 on 2026-09-09 and 3.12.1 on 2026-09-29, and the last push was on 2026-11-01. Two feature releases and one patch inside four weeks is the pace to plan around, and the default branch is main. Two files exist to make that pace survivable: CHANGELOG.md and UPGRADE.md, both at the top level. If you deploy on a schedule instead of continuously, treat a minor bump as an upgrade step with a reading step attached to it, because a patch such as 3.12.1 landing three weeks after 3.12.0 is the pattern you should keep seeing rather than an exception.
MIT terms, one corporate sponsor, and a stated debt to Python's Logbook
Three housekeeping facts sit at the bottom of the project. The licence is MIT, with the terms in the LICENSE file, so nothing about shipping Monolog inside a commercial product needs an exception. The funding line names Better Stack as sponsor and points at a Tidelift subscription and GitHub sponsorship, which means maintenance money comes from outside rather than from a paid edition of the library. The lineage is stated too: the library is heavily inspired by Python's Logbook, with most concepts adjusted to fit the PHP world, which explains design choices that otherwise look idiosyncratic. Older majors are documented on their own branches, with separate 2.x and 1.x READMEs linked from the note at the top.
Editorial conclusion
Take Monolog if your framework already ships it or if you want the PSR-3 guarantee that a later swap to another logger will not break your library's call sites. Do not take it for a version you are about to drop, because 1.x no longer takes PHP support fixes, and do not read the wiki's third-party package list as a compatibility table. Before upgrading, read UPGRADE.md and CHANGELOG.md for the step from 3.11.0 to 3.12.1, and check which PHPStan baseline your PHP version actually falls under before trusting the analysis.
Frequently asked questions
What PHP version does Monolog 3 require?
Monolog ^3.0 works with PHP 8.1 or above. Monolog ^2.5 works with PHP 7.2 or above, and ^1.25 works with PHP 5.3 up to 8.1.
How do you install Monolog?
One command, composer require monolog/monolog, installs the latest version. The package is published on Packagist as monolog/monolog.
Can I swap Monolog for a different logger later?
Yes, that is the point of implementing PSR-3. You can type-hint the interface in your own libraries, which keeps interoperability and lets you use another compatible logger later without changing those call sites.
How do you write log records to a file in Monolog?
Create a Logger and push a StreamHandler with the file path and a level, then call the level methods on the channel. The documented example writes to path/to/your.log with Level::Warning, then logs a warning and an error.
Does Monolog 1.x still get PHP support fixes?
No. The project states that 1.x is not very maintained anymore and will not receive PHP support fixes anymore, and that support is limited to important fixes while you should migrate to 2 or 3 where possible.
Official sources
Add this badge to your README
If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.
[](https://hysenlabs.com/projects/seldaek-monolog)Star history chart for your README
[](https://hysenlabs.com/projects/seldaek-monolog)Was this useful?