https://github.com/razonyang/yii2-log-target-db
Yii2 enhanced database log target
https://github.com/razonyang/yii2-log-target-db
Last synced: about 2 months ago
JSON representation
Yii2 enhanced database log target
- Host: GitHub
- URL: https://github.com/razonyang/yii2-log-target-db
- Owner: razonyang
- License: bsd-3-clause
- Created: 2019-08-14T03:27:10.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2019-08-21T05:03:57.000Z (almost 6 years ago)
- Last Synced: 2025-04-27T02:02:04.137Z (2 months ago)
- Language: PHP
- Size: 6.84 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
Yii2 enhanced database log target
=================================[](https://travis-ci.org/razonyang/yii2-log-target-db)
[](https://scrutinizer-ci.com/g/razonyang/yii2-log-target-db/?branch=master)
[](https://scrutinizer-ci.com/g/razonyang/yii2-log-target-db/?branch=master)
[](https://packagist.org/packages/razonyang/yii2-log-target-db)
[](https://packagist.org/packages/razonyang/yii2-log-target-db)
[](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
------------```
composer require razonyang/yii2-log-target-db
```Usage
-----```php
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:
```shell
$ yii migrate
```