PHPackages                             rowasc/yii2loggingutils - 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. rowasc/yii2loggingutils

ActiveYii2-extension[Logging &amp; Monitoring](/categories/logging)

rowasc/yii2loggingutils
=======================

A very basic logging utility class. Designed to be used as a trait so you can use a default category depending on the class you are at .

1.0.1(10y ago)018[1 issues](https://github.com/rowasc/yii2loggingutils/issues)1MITPHP

Since Sep 6Pushed 10y agoCompare

[ Source](https://github.com/rowasc/yii2loggingutils)[ Packagist](https://packagist.org/packages/rowasc/yii2loggingutils)[ RSS](/packages/rowasc-yii2loggingutils/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (3)Versions (2)Used By (1)

yii2loggingutils
================

[](#yii2loggingutils)

A very basic logging utility to help setup log categories from the controllers that "use" this trait/

Usage
=====

[](#usage)

\##Configuration

In your Yii2's application config, under components=&gt;log setup new logging categories you want to use

```
'components' =>[
'log' => [
    'traceLevel' => YII_DEBUG ? 3 : 0,
    'targets' => [
        [
            'class' => 'yii\log\FileTarget',
            'levels' => ['info', 'error', 'warning', 'trace'],
            'categories' => ['myawesomecategory'],
            'logFile' => '@app/runtime/logs/myawesomecategory.log',
            'maxFileSize' => 2048,
            'maxLogFiles' => 10,
            'logVars' => []
        ]
```

Define your default log category for each class, so you have well defined categories to look into when something goes wrong.
----------------------------------------------------------------------------------------------------------------------------

[](#define-your-default-log-category-for-each-class-so-you-have-well-defined-categories-to-look-into-when-something-goes-wrong)

```
namespace your\own\namespace;
use rowasc\components\Log;
class YourClass extends AnyClass {
    use Log;
    public $log_category="categoryOfYourLog";
    public function yourFancyFunction(){
        /** now use some loggers ! **/
        $this->_logError("Error that you really want to log " );
        $this->_logTrace($e);

    }
}
```

If you want to have a different category for some messages, just override the category when calling the logging functions.
--------------------------------------------------------------------------------------------------------------------------

[](#if-you-want-to-have-a-different-category-for-some-messages-just-override-the-category-when-calling-the-logging-functions)

```
namespace your\own\namespace;
use rowasc\components\Log;
class YourClass extends AnyClass {
    use Log;
    public $log_category="categoryOfYourLog";
    public function yourFancyFunction(){
        /** now use some loggers ! **/
        $this->_logError("Error that you really want to log " ,"myawesomecategory");
        $this->_logTrace($e,"myerrorcategory");

    }
}
```

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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

3908d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/db1d09fdb337fabf5bd899b2c7e853ea7152f2fdd353211174dbacc77cbc8766?d=identicon)[rowasc](/maintainers/rowasc)

---

Top Contributors

[![rowasc](https://avatars.githubusercontent.com/u/2434401?v=4)](https://github.com/rowasc "rowasc (5 commits)")

###  Code Quality

TestsCodeception

### Embed Badge

![Health badge](/badges/rowasc-yii2loggingutils/health.svg)

```
[![Health](https://phpackages.com/badges/rowasc-yii2loggingutils/health.svg)](https://phpackages.com/packages/rowasc-yii2loggingutils)
```

###  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)[mito/yii2-sentry

Yii 2 extension for Sentry

92377.7k](/packages/mito-yii2-sentry)

PHPackages © 2026

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