PHPackages                             razonyang/yii2-log-target-db - 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. razonyang/yii2-log-target-db

ActiveYii2-extension[Logging &amp; Monitoring](/categories/logging)

razonyang/yii2-log-target-db
============================

Yii2 enhanced database log target

1.0.0(6y ago)53.8k1BSD-3-ClausePHPPHP ^7.1

Since Aug 21Pushed 6y ago1 watchersCompare

[ Source](https://github.com/razonyang/yii2-log-target-db)[ Packagist](https://packagist.org/packages/razonyang/yii2-log-target-db)[ RSS](/packages/razonyang-yii2-log-target-db/feed)WikiDiscussions master Synced 2d ago

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

Yii2 enhanced database log target
=================================

[](#yii2-enhanced-database-log-target)

[![Build Status](https://camo.githubusercontent.com/93d762fa27aa9eaa12871d6a47c5c5b6e3c4fae00553b4aa75f73c8e5c47b772/68747470733a2f2f7472617669732d63692e6f72672f72617a6f6e79616e672f796969322d6c6f672d7461726765742d64622e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/razonyang/yii2-log-target-db)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/b8ad021e36501c1f8f5a8463ebd26eaca6db1e0628dbcbdc4f97f71dd4461fb2/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f72617a6f6e79616e672f796969322d6c6f672d7461726765742d64622f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/razonyang/yii2-log-target-db/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/c66f24d39491517e10952b4ebedfac70709177bbc1b81984d35672b6db7ee297/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f72617a6f6e79616e672f796969322d6c6f672d7461726765742d64622f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/razonyang/yii2-log-target-db/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/0ac2121c3c99165911936df5c4aed44284f66cd4bf8a28da2602075652fa244d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72617a6f6e79616e672f796969322d6c6f672d7461726765742d64622e737667)](https://packagist.org/packages/razonyang/yii2-log-target-db)[![Total Downloads](https://camo.githubusercontent.com/9f5f02f1556aefbc58903b9111bb0b4d445d99566c9ece305afa035e714508a9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72617a6f6e79616e672f796969322d6c6f672d7461726765742d64622e737667)](https://packagist.org/packages/razonyang/yii2-log-target-db)[![LICENSE](https://camo.githubusercontent.com/d55fbb86687b670a596d32f6f0b6dcb868138aaf75210f40273b38d26fc8691f/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f72617a6f6e79616e672f796969322d6c6f672d7461726765742d6462)](LICENSE)

Because the built-in database log target can not figure out the context of same request, especially in the case of concurrency, so that the log is very confusing, it is hard to diagnose errors.

According this problem, what this extension do is that record the request ID via `dechex($_SERVER['REQUEST_TIME_FLOAT'] * 1000000)`.

Installation
------------

[](#installation)

```
composer require razonyang/yii2-log-target-db

```

Usage
-----

[](#usage)

```
return [
    // console configuration
    'controllerMap' => [
        'migrate' => [
            'migrationPath' => [
                // ...
                '@yii/log/migrations/',
            ],
            'migrationNamespaces' => [
                // ...
                'RazonYang\Yii2\Log\Db\Migration',
            ],
        ],
    ],

    // common/web/console configuration
    'components' => [
        'log' => [
            'targets' => [
                'db' => [
                    'class' => \RazonYang\Yii2\Log\Db\Target::class,
                    'levels' => ['error', 'warning'],
                    'db' => 'db',
                    'logTable' => '{{%log}}',
                ],
            ],
        ],
    ],
];
```

then:

```
$ yii migrate
```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

2458d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/17720932?v=4)[Razon Yang](/maintainers/RazonYang)[@razonyang](https://github.com/razonyang)

---

Top Contributors

[![razonyang](https://avatars.githubusercontent.com/u/17720932?v=4)](https://github.com/razonyang "razonyang (1 commits)")

---

Tags

logyii2db target

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/razonyang-yii2-log-target-db/health.svg)

```
[![Health](https://phpackages.com/badges/razonyang-yii2-log-target-db/health.svg)](https://phpackages.com/packages/razonyang-yii2-log-target-db)
```

###  Alternatives

[lav45/yii2-activity-logger

Tools to store user activity log for Yii2

3456.3k](/packages/lav45-yii2-activity-logger)

PHPackages © 2026

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