PHPackages                             error-tracker/yii2-log-target - 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. error-tracker/yii2-log-target

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

error-tracker/yii2-log-target
=============================

v1.0.0(6y ago)014.2k↓33.3%[1 PRs](https://github.com/error-tracker/yii2-log-target/pulls)PHP

Since Aug 12Pushed 5y ago2 watchersCompare

[ Source](https://github.com/error-tracker/yii2-log-target)[ Packagist](https://packagist.org/packages/error-tracker/yii2-log-target)[ RSS](/packages/error-tracker-yii2-log-target/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (4)Versions (3)Used By (0)

[Error Tracker](https://error-tracker.com) Yii2 Log Target
==========================================================

[](#error-tracker-yii2-log-target)

Who is this for?
----------------

[](#who-is-this-for)

This is for Yii2 developers that need to integrate their applications with [Error Tracker](https://error-tracker.com). This extension uses the Yii2 log component to send errors and warnings direct to Error Tracker.

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

[](#installation)

Install this package with composer.

```
composer require error-tracker/yii2-log-target
```

Configuration
-------------

[](#configuration)

To configure the [log target](https://www.yiiframework.com/doc/guide/2.0/en/runtime-logging#log-targets)in your application, add the below config. Whenever there is a server side error this will be added to the file log as it normally would. Additionally this will be sent to the error tracker dashboard, for easy searches, alerts and other handy tools.

```
'log' => [
    'targets' => [
        [
            'class' => 'yii\log\FileTarget',
            'levels' => ['error', 'warning'],
        ],
        [
            'class' => 'ErrorTracker\Yii2\ErrorTrackerTarget',
            'levels' => ['error', 'warning'],
            'app_key' => 'YOUR_APP_KEY'
        ],
    ],
],
```

When an error is reported onto Error Tracker, it will be saved with a `Reference`. This is your user's session id, and is also the id you can use to trace the error in your file log where you can find more information about that error error.

Using Yii2's log functions
--------------------------

[](#using-yii2s-log-functions)

You can use Yii2's [error and warning](https://www.yiiframework.com/doc/guide/2.0/en/runtime-logging#log-messages)methods to log errors to Error Tracker without throwing exceptions. This will still be logged in the same way, and will additionally and automatically sent if you have the log target configured. The below code will send an error without throwing an exception.

```
try {
    $this->willBreake();
} catch (\Exception $e) {
    Yii::error($e->getMessage(), $e->getName());
}
```

Disabling
---------

[](#disabling)

Disable your log target by using the [method documented by Yii2](https://www.yiiframework.com/doc/guide/2.0/en/runtime-logging#toggling-log-targets). Optionally disable the target by setting the `enabled` property in the configuration. The below config only enables the logger if your application is in a production environment.

```
[
    'class' => 'ErrorTracker\Yii2\ErrorTrackerTarget',
    'levels' => ['error', 'warning'],
    'app_key' => 'YOUR_APP_KEY',
    'enabled' => YII_ENV_PROD,
],
```

Contributing
------------

[](#contributing)

### Getting set up

[](#getting-set-up)

Clone the repo and run `composer install`. Then start hacking!

### Testing

[](#testing)

All new features of bug fixes must be tested. Testing is with phpunit and can be run with the following command.

```
composer run-script test
```

### Coding Standards

[](#coding-standards)

This library uses psr2 coding standards and `squizlabs/php_codesniffer` for linting. There is a composer script for this:

```
composer run-script lint
```

### Pull Requests

[](#pull-requests)

Before creating a pull request with your changes, the pre-commit script must pass. That can be run as follows:

```
composer run-script pre-commit
```

Credits
-------

[](#credits)

This package is created and maintained by [Practically.io](https://practically.io/)

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity59

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

2462d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/14832454?v=4)[Ade Attwood](/maintainers/AdeAttwood)[@AdeAttwood](https://github.com/AdeAttwood)

---

Top Contributors

[![AdeAttwood](https://avatars.githubusercontent.com/u/14832454?v=4)](https://github.com/AdeAttwood "AdeAttwood (6 commits)")

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

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

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

###  Alternatives

[bedezign/yii2-audit

Yii2 Audit records and displays web/cli requests, database changes, php/js errors and associated data.

201657.4k4](/packages/bedezign-yii2-audit)

PHPackages © 2026

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