PHPackages                             xincheng/yii-trace - 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. xincheng/yii-trace

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

xincheng/yii-trace
==================

yii log append trace id

v1.0.0(1y ago)0130MITPHPPHP &gt;=7.0

Since Jul 18Pushed 1y ago1 watchersCompare

[ Source](https://github.com/thinksvip/yii-trace)[ Packagist](https://packagist.org/packages/xincheng/yii-trace)[ RSS](/packages/xincheng-yii-trace/feed)WikiDiscussions main Synced yesterday

READMEChangelogDependencies (3)Versions (2)Used By (0)

yii-trace-id
============

[](#yii-trace-id)

使用
--

[](#使用)

### 安装

[](#安装)

```

composer require xincheng/yii-trace
```

### 配置

[](#配置)

```
main.php

    use Xincheng\YiiTrace\Bootstrap;

    [
        'bootstrap'  => [Bootstrap::class],
        ...
    ]
```

```
log.php

    'traceLevel' => YII_DEBUG ? 3 : 0,
    'targets' => [
        [
            'class'       => 'yii\log\FileTarget',
            'levels'      => ['error', 'warning', 'info'],
            ...
            'prefix'      => function ($message) {
                return sprintf('[%s]', Yii::$app->params['trace_id']);
            }
        ],
    ]

```

### 获取TraceId

[](#获取traceid)

```
echo Yii::$app->params['trace_id'];

echo Yii::$app->traceId->getTraceId();
```

### 使用外部TraceId

[](#使用外部traceid)

> header里需要设置： x-request-id

### 日志示例

[](#日志示例)

2024-07-16 15:48:41 \[36fb958d-3c5d-2928-a8be-2f77b2e50d8a\]\[info\]\[backend\\modules\\v1\\service\\base\\OrderStrategyService::getShipping\]

###  Health Score

23

—

LowBetter than 26% of packages

Maintenance31

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

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

715d ago

### Community

Maintainers

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

---

Top Contributors

[![BaiNight](https://avatars.githubusercontent.com/u/45897338?v=4)](https://github.com/BaiNight "BaiNight (1 commits)")[![thinksvip](https://avatars.githubusercontent.com/u/23026450?v=4)](https://github.com/thinksvip "thinksvip (1 commits)")

---

Tags

traceid

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/xincheng-yii-trace/health.svg)

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

###  Alternatives

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[skeeks/cms

SkeekS CMS — control panel and tools based on php framework Yii2

13825.8k58](/packages/skeeks-cms)[lav45/yii2-activity-logger

Tools to store user activity log for Yii2

3460.8k](/packages/lav45-yii2-activity-logger)[bacularis/bacularis-app

Bacularis - The Bacula web interface

254.4k](/packages/bacularis-bacularis-app)[yii2mod/yii2-cron-log

Component for logging cron jobs

2328.5k1](/packages/yii2mod-yii2-cron-log)[bacularis/bacularis-web

Web files for Bacularis - The Bacula web interface

104.0k8](/packages/bacularis-bacularis-web)

PHPackages © 2026

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