PHPackages                             apix/log - 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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. apix/log

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

apix/log
========

Minimalist, thin and fast PSR-3 compliant (multi-bucket) logger.

1.3.0(3y ago)511.0M↓14.6%3[5 issues](https://github.com/apix/log/issues)[2 PRs](https://github.com/apix/log/pulls)17BSD-3-ClausePHPPHP &gt;=8.0

Since Sep 30Pushed 1y ago4 watchersCompare

[ Source](https://github.com/apix/log)[ Packagist](https://packagist.org/packages/apix/log)[ Docs](https://github.com/frqnck/apix-log)[ RSS](/packages/apix-log/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (13)Used By (17)

APIx Log, very thin PSR-3 logger [![Build Status](https://camo.githubusercontent.com/dd297135eff1a673b44b5b89a9ab63e78dbe34902809f99441f6474b35c290c8/68747470733a2f2f7472617669732d63692e6f72672f617069782f6c6f672e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/apix/log)
========================================================================================================================================================================================================================================================================================

[](#apix-log-very-thin-psr-3-logger)

[![Latest Stable Version](https://camo.githubusercontent.com/961a89cb3bad56d0a332cb08b8f46073ed33cefdf403dd055e41cb61be7e8882/68747470733a2f2f706f7365722e707567782e6f72672f617069782f6c6f672f76657273696f6e)](https://packagist.org/packages/apix/log)[![Total Downloads](https://camo.githubusercontent.com/ad866fe5983ce8e562a49ffff983161b89f49a2cb1ae928453309857236457e8/68747470733a2f2f706f7365722e707567782e6f72672f617069782f6c6f672f646f776e6c6f616473)](https://packagist.org/packages/apix/log)[![Build Status](https://camo.githubusercontent.com/a89fc100019d4946d1a645786e8940a98ca4d570a3edf060d8c21da96cd9413b/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f617069782f6c6f672f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/apix/log/build-status/master)[![Code Quality](https://camo.githubusercontent.com/e40fced834372955c71f477b90fa88dd149a4634f6715f6b7a090a2a1d9e6ed6/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f617069782f6c6f672f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/apix/log/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/ab7d734841a3338ed41bfdd70b26e302bcfd6ff7548bc7befab70c7b7f93d4e5/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f617069782f6c6f672f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/apix/log/?branch=master)[![License](https://camo.githubusercontent.com/173cf20c428e9f2d3444e074a6ad466bb58101dad0ad381df32e4beea506e3ea/68747470733a2f2f706f7365722e707567782e6f72672f617069782f6c6f672f6c6963656e73652e737667)](https://packagist.org/packages/apix/log)

Minimalist and fast **PSR-3** compliant logger.

- Light, come out-of-the-box bundle with wrappers for:
    - [ErrorLog](src/Logger/ErrorLog.php), [File](src/Logger/File.php), [Mail](src/Logger/Mail.php), [Sapi](src/Logger/Sapi.php) ~ built around the `error_log()` function,
    - [Runtime](src/Logger/Runtime.php) ~ as an Array/ArrayObject wrapper, and [Nil](src/Logger/Nil.php) ~ as Null wrapper,
    - [Stream](src/Logger/Stream.php) ~ logs are sent to sockets, local and remote files, filters and other similar resources (default to standard output bypassing output buffering).
- Extendable, additional logging backends are available:
    - [PHPMailer/apix-log-phpmailer](https://github.com/PHPMailer/apix-log-phpmailer) ~ logs are sent using PHPMailer,
    - [jspalink/apix-log-pushover](https://github.com/jspalink/apix-log-pushover) ~ logs are sent using Pushover,
    - [apix/log-tracker](https://github.com/apix/log-tracker) ~ adds logger/tracker such as Google Analytics, Dashbot, etc...,
    - More contributions will be linked here.
- Clean API, see the [`LoggerInterface`](src/Logger/LoggerInterface.php) and the [`LogFormatterInterface`](src/LogFormatterInterface.php).
- 100% Unit **tested** and compliant with PSR0, PSR1 and PSR2.
- [Continuously integrated](//travis-ci.org/apix/log) against **7.0**, **8.x**, and HHVM (use ^1.1 for older PHP versions).
- Available as a [Composer](https://packagist.org/packages/apix/log) and as a [PEAR](http://pear.ouarz.net) package.

Feel free to comment, send pull requests and patches...

🆕 *Log dispatch can be postponed/accumulated using `setDeferred()`.*

Basic usage ~ *standalone*
--------------------------

[](#basic-usage--standalone)

```
$urgent_logger = new Apix\Log\Logger\Mail('franck@foo.bar');
$urgent_logger->setMinLevel('critical');   // catch logs >= to `critical`
```

This simple logger is now set to intercept `critical`, `alert` and `emergency` logs.

To log an event, use:

```
$urgent_logger->alert('Running out of {stuff}', ['stuff' => 'beers']);
```

Advanced usage ~ *multi-logs dispatcher*
----------------------------------------

[](#advanced-usage--multi-logs-dispatcher)

Lets create an additional logger with purpose of catching log entries that have a severity level of `warning` or more -- see the [log levels](#log-levels) for the order.

```
$app_logger = new Apix\Log\Logger\File('/var/log/apix_app.log');
$app_logger->setMinLevel('warning')  // intercept logs that are >= `warning`
           ->setCascading(false)     // don't propagate to further buckets
           ->setDeferred(true);      // postpone/accumulate logs processing
```

`setCascading()` was set to *false* (default is *true*) so the entries caught here won't continue downstream past that particular log bucket. `setDeferred()` was set to *true* (default is *false*) so processing happen on `__destruct` (end of script generally) rather than on the fly.

Now, lets create a main logger object and inject the two previous loggers.

```
// The main logger object (injecting an array of loggers)
$logger = new Apix\Log\Logger( array($urgent_logger, $app_logger) );
```

Lets create an additional logger -- just for development/debug purposes.

```
if(DEBUG) {
  // Bucket for the remaining logs -- i.e. `notice`, `info` and `debug`
  $dev_logger = new Apix\Log\Logger\Stream(); // default to screen without output buffer
  // $dev_logger = new Logger\File('/tmp/apix_debug.log');
  $dev_logger->setMinLevel('debug');

  $logger->add($dev_logger);   		// another way to inject a log bucket
}
```

Finally, lets push some log entries:

```
$e = new \Exception('Boo!');

// handled by both $urgent_logger & $app_logger
$logger->critical('OMG saw {bad-exception}', [ 'bad-exception' => $e ]);

// handled by $app_logger
$logger->error($e); // push an object (or array) directly

// handled by $dev_logger
$logger->info('Testing a var {my_var}', array('my_var' => array(...)));
```

Log levels
----------

[](#log-levels)

The eight [RFC 5424](http://tools.ietf.org/html/rfc5424#section-6.2.1) levels of logs are supported, in cascading order:

SeverityDescriptionEmergencySystem level failure (not application level)AlertFailure that requires immediate attentionCriticalSerious failure at the application levelErrorRuntime errors, used to log unhandled exceptionsWarningMay indicate that an error will occur if action is not takenNoticeEvents that are unusual but not error conditionsInfoNormal operational messages (no action required)DebugVerbose info useful to developers for debugging purposes (default)Installation
------------

[](#installation)

Install the current major version using Composer with (recommended)

```
composer require apix/log:1.3.*

```

Or install the latest stable version with

```
composer require apix/log

```

License
-------

[](#license)

APIx Log is licensed under the New BSD license -- see the `LICENSE.txt` for the full license details.

###  Health Score

47

—

FairBetter than 94% of packages

Maintenance25

Infrequent updates — may be unmaintained

Popularity49

Moderate usage in the ecosystem

Community23

Small or concentrated contributor base

Maturity75

Established project with proven stability

 Bus Factor1

Top contributor holds 98.1% 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 ~266 days

Recently: every ~645 days

Total

12

Last Release

1321d ago

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

1.3.0PHP &gt;=8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/1dbf52cf502005b3980f141849589ca308ddf20652b0c3c6371305dad2b9b1df?d=identicon)[frqnck](/maintainers/frqnck)

---

Top Contributors

[![frqnck](https://avatars.githubusercontent.com/u/479874?v=4)](https://github.com/frqnck "frqnck (151 commits)")[![8ctopus](https://avatars.githubusercontent.com/u/13252042?v=4)](https://github.com/8ctopus "8ctopus (3 commits)")

---

Tags

apixapix-logerror-logphpphpmailerpushoverstreampsrlogpsr-3loggingtrackingloggerapixtrackerpsr-log

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/apix-log/health.svg)

```
[![Health](https://phpackages.com/badges/apix-log/health.svg)](https://phpackages.com/packages/apix-log)
```

###  Alternatives

[monolog/monolog

Sends your logs to files, sockets, inboxes, databases and various web services

21.4k964.9M7.0k](/packages/monolog-monolog)[analog/analog

Fast, flexible, easy PSR-3-compatible PHP logging package with dozens of handlers.

3451.5M24](/packages/analog-analog)[bugsnag/bugsnag-psr-logger

Official Bugsnag PHP PSR Logger.

32132.5M2](/packages/bugsnag-bugsnag-psr-logger)[inpsyde/wonolog

Monolog-based logging package for WordPress.

183617.9k7](/packages/inpsyde-wonolog)[markrogoyski/simplelog-php

Powerful PSR-3 logging. So easy, it's simple.

2818.1k4](/packages/markrogoyski-simplelog-php)[atrapalo/monolog-elasticsearch

A Monolog handler and formatter that makes use of the elasticsearch/elasticsearch package

1123.0k](/packages/atrapalo-monolog-elasticsearch)

PHPackages © 2026

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