PHPackages                             donsimon/yii2-log-target-file - 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. donsimon/yii2-log-target-file

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

donsimon/yii2-log-target-file
=============================

Yii 2.0 customizable log message fileTarget

1.0.0(7y ago)188BSD-3-ClausePHPPHP &gt;=7.0.0

Since Oct 30Pushed 7y ago1 watchersCompare

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

READMEChangelogDependencies (1)Versions (5)Used By (0)

Yii2 LogTargetFile
==================

[](#yii2-logtargetfile)

Customize the log messages

Sort and change the log message's units

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

[](#installation)

Just run in your console:

```
composer require donsimon/yii2-log-target-file "*"

```

or add

```
"donsimon/yii2-log-target-file": "*"

```

to the require section of your composer.json file.

Usage
-----

[](#usage)

Add following line to your main configuration file (e.g. config/main.php),

```
    'bootstrap' => ['log'],

```

Then,

Add following lines to the components section in configuration file,

```
        'log' => [
        //          'traceLevel' => YII_DEBUG ? 3 : 0,
                    'targets' => [
                          [
                                'class' => 'donsimon\log\logTargetFile',
                                'levels' => ['info','warning','error'],
                                'categories' => ['user','application'],
                                'logVars' => ['_GET', '_POST', '_FILES', '_COOKIE', '_SESSION', '_SERVER'],
                                'logFile' => '@backend/runtime/logs/appAndUser.log',
                                'logMessageContainer' =>['timestamp','prefix','level','category','message'],
                                'prefixContainer'=>['ip','userId','sessionId']
                            ]
                    ],
        ],
```

To write on log file client should call something like this,

`Yii::info($message, $category);`

Here $message and $category are variables.

your log will update.

What you can do here,
---------------------

[](#what-you-can-do-here)

You can change log file name using `logFile`.

```
eg: @backend/runtime/logs/user-activities.log

```

You can add many `categories`.

```
eg: ['yii\web\HttpException:*','yii\base\ErrorException:*','user','application']

```

You can add many `levels`

```
eg: ['info','warning','error']

```

You can print vars using `logVars`.

[Refer more](https://www.yiiframework.com/doc/guide/2.0/en/runtime-logging)

New
---

[](#new)

`logMessageContainer` is a array of log messages units `['timestamp','prefix','level','category','message']`.

You can sort and change log messages units using `logMessageContainer`

`prefixContainer` is a array of prefix units `['ip','userId','sessionId']`.

You can sort and change log messages prefix using `prefixContainer`

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

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

Every ~2 days

Total

4

Last Release

2743d ago

Major Versions

0.5.0 → 1.0.02018-11-07

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5130168?v=4)[DSP Chathura Sudarsha](/maintainers/chathurasudarsha)[@chathurasudarsha](https://github.com/chathurasudarsha)

---

Top Contributors

[![chathurasudarsha](https://avatars.githubusercontent.com/u/5130168?v=4)](https://github.com/chathurasudarsha "chathurasudarsha (2 commits)")

---

Tags

logfileyii2extensioncustomizableFileTarget

### Embed Badge

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

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

###  Alternatives

[lav45/yii2-activity-logger

Tools to store user activity log for Yii2

3456.3k](/packages/lav45-yii2-activity-logger)[kriss/yii2-log-reader

Yii2 log reader

1340.1k1](/packages/kriss-yii2-log-reader)

PHPackages © 2026

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