dmstr/ yii2-log
SyslogTarget 将日志写入syslog。
0.1.0
2015-01-09 16:17 UTC
Requires
- yiisoft/yii2: *
This package is auto-updated.
Last update: 2024-09-13 01:25:25 UTC
README
SyslogTarget 将日志写入syslog。
安装
安装此扩展的首选方式是通过 composer。
运行
php composer.phar require --prefer-dist dmstr/yii2-log "*"
用法
扩展安装后,只需在代码中使用即可
'log' => [
'targets' => [
[
'class' => 'dmstr\log\SyslogTarget',
'levels' => ['error', 'warning', 'info', 'trace'],
'enabled' => true,
'logVars' => ['_GET','_POST'],
],
],
],
设置
输出目前通过
error_log()
发送,允许您捕获nginx中的php-fpm输出,**用于开发**。此扩展主要针对与docker、fig和vagrant一起使用进行开发。
示例输出
使用 fig up
或 docker run
启动docker容器
web_1 | 2015/01/09 16:13:36 [error] 52#0: *163 FastCGI sent in stderr: "PHP message: dmstr\log\SyslogTarget::export via error_log() ===
web_1 | PHP message:
web_1 | --- begin ---
web_1 | PHP message: [trace][yii\base\Application::bootstrap] Bootstrap with schmunk42\packaii\Bootstrap::bootstrap()
web_1 | PHP message: [trace][yii\base\Application::bootstrap] Bootstrap with dektrium\user\Bootstrap::bootstrap()
web_1 | PHP message: [trace][yii\base\Module::getModule] Loading module: user
web_1 | PHP message: [trace][yii\base\Application::bootstrap] Bootstrap with schmunk42\giiant\Bootstrap::bootstrap()
web_1 | PHP message: [trace][yii\base\Module::getModule] Loading module: gii
web_1 | PHP message: [trace][yii\base\Application::bootstrap] Bootstrap with schmunk42\markdocs\Bootstrap::bootstrap()
web_1 | PHP message: [trace][yii\base\Application::bootstrap] Bootstrap with yii\log\Dispatcher
web_1 | PHP message: [trace][yii\base\Module::getModule] Loading module: debug
web_1 | PHP message: [trace][yii\base\Application::bootstrap] Bootstrap with yii\debug\Module::bootstrap()
web_1 | PHP message: [trace][yii\base\Application::bootstrap] Bootstrap with yii\gii\Module::bootstrap()
web_1 | PHP message: [trace][yii\web\UrlManager::parseRequest] No matching URL rules. Using default URL parsing logic.
web_1 | PHP message: [trace][yii\web\Application::handleRequest] Route requested: ''
[...]
web_1 | PHP message: [trace][yii\base\View::renderFile] Rendering view file: /app/views/layouts/_modal.php
web_1 | PHP message: [info][application] $_COOKIE = [
web_1 | 'PHPSESSID' => 'xxxxxxxxxxxxxxxx'
web_1 | ]
web_1 |
web_1 | $_SESSION = [
web_1 | '__flash' => []
web_1 | '__id' => 1
web_1 | '__captcha/site/captcha' => 'xxxxxx'
web_1 | '__captcha/site/captchacount' => 1
web_1 | ]
web_1 | PHP message:
web_1 | --- end ---" while reading upstream, client: 192.168.59.3, server: web, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "docker.local:49177", referrer: "http://docker.local:49177/docs/42-testing.md"