PHPackages                             cakephp/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. [Framework](/categories/framework)
4. /
5. cakephp/log

ActiveLibrary[Framework](/categories/framework)

cakephp/log
===========

CakePHP logging library with support for multiple different streams

5.4.1(1mo ago)247.9M↓41.3%310MITPHPPHP &gt;=8.2

Since Nov 12Pushed 2w ago26 watchersCompare

[ Source](https://github.com/cakephp/log)[ Packagist](https://packagist.org/packages/cakephp/log)[ Docs](https://cakephp.org)[ RSS](/packages/cakephp-log/feed)WikiDiscussions 5.x Synced 2w ago

READMEChangelogDependencies (10)Versions (358)Used By (10)

[![Total Downloads](https://camo.githubusercontent.com/9f87d55ae3686efdd45c51d4d63cd7d9534e9230b4059de4776741a66876bbe7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f63616b657068702f6c6f672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/cakephp/log)[![License](https://camo.githubusercontent.com/942e017bf0672002dd32a857c95d66f28c5900ab541838c6c664442516309c8a/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e7376673f7374796c653d666c61742d737175617265)](LICENSE.txt)

CakePHP Logging Library
=======================

[](#cakephp-logging-library)

The Log library provides a `Log` service locator for interfacing with multiple logging backends using a simple interface. With the `Log` class it is possible to send a single message to multiple logging backends at the same time or just a subset of them based on the log level or context.

By default, you can use `File` or `Syslog` as logging backends, but you can use any object implementing `Psr\Log\LoggerInterface` as an engine for the `Log` class.

Usage
-----

[](#usage)

You can define as many or as few loggers as your application needs. Loggers should be configured using `Cake\Log\Log.` An example would be:

```
use Cake\Log\Log;

// Short classname
Log::setConfig('local', [
    'className' => 'File',
    'levels' => ['notice', 'info', 'debug'],
    'file' => '/path/to/file.log',
]);

// Fully namespaced name.
Log::setConfig('production', [
    'className' => \Cake\Log\Engine\SyslogLog::class,
    'levels' => ['warning', 'error', 'critical', 'alert', 'emergency'],
]);
```

It is also possible to create loggers by providing a closure.

```
Log::setConfig('special', function () {
	// Return any PSR-3 compatible logger
	return new MyPSR3CompatibleLogger();
});
```

Or by injecting an instance directly:

```
Log::setConfig('special', new MyPSR3CompatibleLogger());
```

You can then use the `Log` class to pass messages to the logging backends:

```
Log::write('debug', 'Something did not work');
```

Only the logging engines subscribed to the log level you are writing to will get the message passed. In the example above, only the 'local' engine will get the log message.

### Filtering messages with scopes

[](#filtering-messages-with-scopes)

The Log library supports another level of message filtering. By using scopes, you can limit the logging engines that receive a particular message.

```
// Configure /logs/payments.log to receive all levels, but only
// those with `payments` scope.
Log::setConfig('payments', [
    'className' => 'File',
    'levels' => ['error', 'info', 'warning'],
    'scopes' => ['payments'],
    'file' => '/logs/payments.log',
]);

Log::warning('this gets written only to payments.log', ['scope' => ['payments']]);
```

Documentation
-------------

[](#documentation)

Please make sure you check the [official documentation](https://book.cakephp.org/5/en/core-libraries/logging.html)

###  Health Score

74

—

ExcellentBetter than 100% of packages

Maintenance95

Actively maintained with recent releases

Popularity53

Moderate usage in the ecosystem

Community38

Small or concentrated contributor base

Maturity95

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~12 days

Total

352

Last Release

27d ago

Major Versions

3.9.5 → 4.2.102020-12-29

4.4.9 → 5.0.0-beta12022-10-11

4.4.14 → 5.0.0-beta22023-04-01

4.5.4 → 5.0.02023-04-18

5.x-dev → 6.x-dev2026-07-22

PHP version history (7 changes)3.4.8PHP &gt;=5.6.0

4.0.0-beta1PHP &gt;=7.2.0

3.10.1PHP &gt;=5.6.0,&lt;8.0.0

4.4.0-RC1PHP &gt;=7.4.0

5.0.0-beta1PHP &gt;=8.1

5.3.0-RC1PHP &gt;=8.2

6.x-devPHP &gt;=8.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/23666?v=4)[CakePHP](/maintainers/cakephp)[@cakephp](https://github.com/cakephp)

---

Top Contributors

[![ADmad](https://avatars.githubusercontent.com/u/142658?v=4)](https://github.com/ADmad "ADmad (136 commits)")[![markstory](https://avatars.githubusercontent.com/u/24086?v=4)](https://github.com/markstory "markstory (94 commits)")[![dereuromark](https://avatars.githubusercontent.com/u/39854?v=4)](https://github.com/dereuromark "dereuromark (62 commits)")[![othercorey](https://avatars.githubusercontent.com/u/24221186?v=4)](https://github.com/othercorey "othercorey (60 commits)")[![lorenzo](https://avatars.githubusercontent.com/u/37621?v=4)](https://github.com/lorenzo "lorenzo (27 commits)")[![ravage84](https://avatars.githubusercontent.com/u/625761?v=4)](https://github.com/ravage84 "ravage84 (15 commits)")[![AD7six](https://avatars.githubusercontent.com/u/33387?v=4)](https://github.com/AD7six "AD7six (8 commits)")[![bcrowe](https://avatars.githubusercontent.com/u/752603?v=4)](https://github.com/bcrowe "bcrowe (8 commits)")[![LordSimal](https://avatars.githubusercontent.com/u/9105243?v=4)](https://github.com/LordSimal "LordSimal (8 commits)")[![josegonzalez](https://avatars.githubusercontent.com/u/65675?v=4)](https://github.com/josegonzalez "josegonzalez (7 commits)")[![mtak3](https://avatars.githubusercontent.com/u/1726154?v=4)](https://github.com/mtak3 "mtak3 (5 commits)")[![mehdi-fathi](https://avatars.githubusercontent.com/u/11867691?v=4)](https://github.com/mehdi-fathi "mehdi-fathi (4 commits)")[![antograssiot](https://avatars.githubusercontent.com/u/4977112?v=4)](https://github.com/antograssiot "antograssiot (3 commits)")[![roland-w-2024](https://avatars.githubusercontent.com/u/126562443?v=4)](https://github.com/roland-w-2024 "roland-w-2024 (2 commits)")[![bravo-kernel](https://avatars.githubusercontent.com/u/230500?v=4)](https://github.com/bravo-kernel "bravo-kernel (2 commits)")[![jzdunek](https://avatars.githubusercontent.com/u/2212209?v=4)](https://github.com/jzdunek "jzdunek (2 commits)")[![Harfusha](https://avatars.githubusercontent.com/u/47174548?v=4)](https://github.com/Harfusha "Harfusha (2 commits)")[![phpnut](https://avatars.githubusercontent.com/u/148097?v=4)](https://github.com/phpnut "phpnut (1 commits)")[![renan](https://avatars.githubusercontent.com/u/28046?v=4)](https://github.com/renan "renan (1 commits)")[![saeideng](https://avatars.githubusercontent.com/u/8215801?v=4)](https://github.com/saeideng "saeideng (1 commits)")

---

Tags

logloggingcakephpStreams

### Embed Badge

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

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

###  Alternatives

[symfony/symfony

The Symfony PHP framework

31.4k87.4M2.2k](/packages/symfony-symfony)[cakephp/database

Flexible and powerful Database abstraction library with a familiar PDO-like API

9827.0M52](/packages/cakephp-database)[tempest/framework

The PHP framework that gets out of your way.

2.3k37.6k21](/packages/tempest-framework)[cakephp/utility

CakePHP Utility classes such as Inflector, String, Hash, and Security

12129.7M97](/packages/cakephp-utility)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19467.3M1.9k](/packages/drupal-core)[cakephp/datasource

Provides connection managing and traits for Entities and Queries that can be reused for different datastores

4727.1M17](/packages/cakephp-datasource)

PHPackages © 2026

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