PHPackages                             choate/yii-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. choate/yii-log

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

choate/yii-log
==============

Yii2 extension log

14PHP

Since May 24Pushed 9y ago1 watchersCompare

[ Source](https://github.com/Choate/yii-log)[ Packagist](https://packagist.org/packages/choate/yii-log)[ RSS](/packages/choate-yii-log/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

Yii2-log
========

[](#yii2-log)

扩展日志格式

支持格式
====

[](#支持格式)

1. json

安装
==

[](#安装)

基于composer安装

`php composer.phar require choate/yii-log`

使用
==

[](#使用)

```
'log'        => [
    'targets'       => [
        'trace' => [
            'class'   => 'choate\yii\log\JsonFileTarget',
            'levels'  => 79,
            'logFile' => '@runtime/logs/console.log',
        ],
    ],
],
```

Targets
=======

[](#targets)

JsonFileTarget
--------------

[](#jsonfiletarget)

### 配置说明

[](#配置说明)

1. `logTag` 日志唯一标识符，用于追踪一个请求所产生的日志

### 输出日志说明

[](#输出日志说明)

```
{
    ip: "-",  // 请求IP
    user_id: "-",  // 请求用户
    session_id: "-",  // 请求用户SESSION ID
    request_id: "59252e208c8ac",  // 请求唯一标识符用于追踪日志
    application: "default", // 请求应用
    route: "default/index",  // 请求路由
    status_code: 0,  // 响应状态码
    request_time: "2017-05-24 14:54:24",  // 请求时间
    start_time: 1495608864.568761,
    end_time: 1495608864.576908,
    duration: "8 ms",  // 请求耗时
    SERVER: {},  // PHP $_SERVER
    COOKIE: {}, // PHP $_COOKIE
    POST: {}, // PHP $_POST
    GET: {}, // PHP $_GET
    FILES: {}, // PHP $_FILES
    operation: { // 请求操作路由日志
        0: {
            level: "info",
            category: "application",
            timestamp: "2017-05-24 14:54:24",
            text: "成功",
            traces: [ ]
        },
        1: {
            level: "info",
            category: "application",
            timestamp: "2017-05-24 14:54:24",
            text: "成功",
            traces: [ ]
        }
    }
}

```

###  Health Score

19

—

LowBetter than 9% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

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.

### Community

Maintainers

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

---

Tags

yii2yii2-extensionyii2-log

### Embed Badge

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

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

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B10.9k](/packages/psr-log)[open-telemetry/api

API for OpenTelemetry PHP.

1938.5M262](/packages/open-telemetry-api)[open-telemetry/sdk

SDK for OpenTelemetry PHP.

2326.5M315](/packages/open-telemetry-sdk)[illuminated/console-logger

Logging and Notifications for Laravel Console Commands.

8676.7k](/packages/illuminated-console-logger)

PHPackages © 2026

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