PHPackages                             mitallast/php-logger - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. mitallast/php-logger

AbandonedArchivedLibrary

mitallast/php-logger
====================

Simple and fast php logging library

v2.0.0(10y ago)595021MITPHPPHP &gt;=5.5.0

Since Nov 25Pushed 1y ago2 watchersCompare

[ Source](https://github.com/mitallast/php-logger)[ Packagist](https://packagist.org/packages/mitallast/php-logger)[ RSS](/packages/mitallast-php-logger/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (1)Versions (7)Used By (1)

Repository is archived
======================

[](#repository-is-archived)

If you want to maintain it, you can make a fork.

php-logger
==========

[](#php-logger)

This is a fork of Apache log4php logging library.

Main theme - light and fast library, with simple configuring.

If you want use classes without namespaces, see [mougrim/php-logger-old-interface](https://github.com/mougrim/php-logger-old-interface).

See [changelog](CHANGELOG.md) and [upgrade instructions](UPGRADE.md).

[![Latest Stable Version](https://camo.githubusercontent.com/2e50f1bb90b95afbbbb124bb92d2506d1ffbbaf9579a18661aaed0fc273f9258/68747470733a2f2f706f7365722e707567782e6f72672f6d6f756772696d2f7068702d6c6f676765722f76657273696f6e)](https://packagist.org/packages/mougrim/php-logger)[![Latest Unstable Version](https://camo.githubusercontent.com/8db2387aa8c384b3d9eec6cfef4c01538c024f801bd34dd514f55fd9c0ca3c44/68747470733a2f2f706f7365722e707567782e6f72672f6d6f756772696d2f7068702d6c6f676765722f762f756e737461626c65)](https://packagist.org/packages/mougrim/php-logger)[![License](https://camo.githubusercontent.com/c80d65e4e8ecbcd065300f381e09cad6e1e51cadc16df65a453eec6660f41650/68747470733a2f2f706f7365722e707567782e6f72672f6d6f756772696d2f7068702d6c6f676765722f6c6963656e7365)](https://packagist.org/packages/mougrim/php-logger)[![Build Status](https://camo.githubusercontent.com/29620b9aeb74eb134c4b5f1b0d5b1f6a940af8b1bc719fa7056e92507d82321e/68747470733a2f2f6170692e7472617669732d63692e6f72672f6d6f756772696d2f7068702d6c6f676765722e706e673f6272616e63683d6d6173746572)](https://travis-ci.org/mougrim/php-logger)[![Test Coverage](https://camo.githubusercontent.com/009873231b3c4cdc985ab0b718616b304906726ad12053fe50901e0af3492de2/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f6d6f756772696d2f7068702d6c6f676765722f6261646765732f636f7665726167652e737667)](https://codeclimate.com/github/mougrim/php-logger/coverage)

Configuration
-------------

[](#configuration)

```
use Mougrim\Logger\Appender\AppenderStream;
use Mougrim\Logger\Layout\LayoutPattern;
use Mougrim\Logger\Layout\LayoutSimple;
use Mougrim\Logger\Logger;

Logger::configure([
    'policy' => [
        'ioError' => 'trigger_error', // ignore, trigger_warn, trigger_error, exception or exit
        'configurationError' => 'exception'
    ],
    'layouts' => [
        'simple' => [
            'class' => LayoutSimple::class,
        ],
        'pattern' => [
            'class' => LayoutPattern::class,
            'pattern' => '{date:Y/m/d} [{level}] {logger} {location:file:line, class.function} {mdc:key} {mdc} {ndc}: {message} {ex}',
        ],
    ],
    'appenders' => [
        'stream' => [
            'class' => AppenderStream::class,
            'stream' => 'php://stdout',
            // pass useLock and useLockShortMessage true for enable lock
            'useLock' => false,
            'useLockShortMessage' => false,
            'minLevel' => Logger::DEBUG,
            'maxLevel' => Logger::FATAL,
            'layout' => 'simple',
        ],
    ],
    'loggers' => [
        'logger' => [
            'appenders' => ['stream'],
            'addictive' => false,
            'minLevel' => Logger::TRACE,
            'maxLevel' => Logger::FATAL,
        ],
    ],
    'root' => [
        'appenders' => ['stream'],
    ]
]);
```

Logging
-------

[](#logging)

```
Logger::getLogger('logger')->trace("hello world");
Logger::getLogger('logger')->debug("hello world");
Logger::getLogger('logger')->info("hello world");
Logger::getLogger('logger')->warn("hello world");
Logger::getLogger('logger')->fatal("hello world");
Logger::getLogger('logger')->log(Logger::DEBUG, "hello world");
```

Mapped Diagnostic Context, mdc
------------------------------

[](#mapped-diagnostic-context-mdc)

```
LoggerMDC::put("request", $i++);
Logger::getLogger('accesslog')->info("new request");
Logger::getLogger('db')->info("execute sql");

# in some web log : cat log | grep 12412
accesslog [request=12412] new request
db [request=12412] execute sql
```

Timer
-----

[](#timer)

```
$logger = Logger::getLogger('db');
$timer = $logger->timer();
$pdo->exec('select * from foo');
$timer->info("sql executed at {time}"); // rendered at
```

Thanks
------

[](#thanks)

Thanks to [mitallast](https://github.com/mitallast/) for the development of the main part of this project.

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance28

Infrequent updates — may be unmaintained

Popularity20

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 57.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~216 days

Total

4

Last Release

3901d ago

Major Versions

1.0.2 → v2.0.02015-09-03

PHP version history (2 changes)1.0.0PHP &gt;=5.2.7

v2.0.0PHP &gt;=5.5.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/28b4a4e5d347ea7ca93ad487441ea2df16b5ea7142bc0ae5f90f283c2c3753ca?d=identicon)[mitallast](/maintainers/mitallast)

---

Top Contributors

[![mitallast](https://avatars.githubusercontent.com/u/531623?v=4)](https://github.com/mitallast "mitallast (46 commits)")[![mougrim](https://avatars.githubusercontent.com/u/1057709?v=4)](https://github.com/mougrim "mougrim (34 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/mitallast-php-logger/health.svg)

```
[![Health](https://phpackages.com/badges/mitallast-php-logger/health.svg)](https://phpackages.com/packages/mitallast-php-logger)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
