PHPackages                             kingsoft/monolog-handler - 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. kingsoft/monolog-handler

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

kingsoft/monolog-handler
========================

Additional handlers monolog, log rotation and cron handler

1.2.2(1y ago)0218[1 issues](https://github.com/theking2/kingsoft-monolog-handler/issues)MITPHPCI passing

Since Feb 5Pushed 1y ago1 watchersCompare

[ Source](https://github.com/theking2/kingsoft-monolog-handler)[ Packagist](https://packagist.org/packages/kingsoft/monolog-handler)[ RSS](/packages/kingsoft-monolog-handler/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (8)Dependencies (4)Versions (10)Used By (0)

Rotating and Crontab StreamingFileHandler for Monolog
=====================================================

[](#rotating-and-crontab-streamingfilehandler-for-monolog)

This handler combines rotating (`AbstractRotatingFileHandler`) with an crontab based FileHandler (`CronRotatingFileHandler`) to offer a cron based rotating file handler. It is based on `Cesargb\php-log-rotation` for advanced rotation and `dragonmantank\cron-expression` for cron interpretation. The abstract class can be used for different ways of rotation and requires an implementation of `mustRotate()` to estblish to know if a rotation is needed.

Future versions might split the two and who knows `AbstractRotatingFileHandler` might end up in `Monolog`...

Install and configure
=====================

[](#install-and-configure)

Use `Kingoft/Utils` to include make a global `SETTINGS` available. Or look at the `PHPUNIT` test file to see what is needed to configure.

```
require $_SERVER['DOCUMENT_ROOT'] . '/vendor/kingsoft/utils/settings.inc.php';
```

CronRotatingFileHandler
-----------------------

[](#cronrotatingfilehandler)

Example usage

```
$log = new Monolog\Logger( SETTINGS['log']['name'] );

$log->pushHandler(
	new \Kingsoft\MonologHandler\CronRotatingFileHandler(
		SETTINGS['log']['location'] . '/' . SETTINGS['log']['name'] . '_info.log',
		Monolog\Level::fromName( SETTINGS['log']['level'],
		SETTINGS['logrotate'] )
	)
);
```

With this in the ini-file

```
[log]
name = "app"
location = "D:/Projekte/logs"
level = Info

[logrotate]
cronExpression = '* */1 * * *'
maxFiles = 2
minSize = 120
compress = false
```

Important

Rotation will not work if a another instance is opening the log and write an entry. This would touch the `.state` and will not rotate!. This could happen for instance and API write to the same log file before a frontend application pings back to the server. In other words this logger is currently not reentrant-safe.

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance42

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 91.3% 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 ~48 days

Recently: every ~96 days

Total

9

Last Release

481d ago

Major Versions

0.1.1 → 1.0.02024-02-06

### Community

Maintainers

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

---

Top Contributors

[![theking2](https://avatars.githubusercontent.com/u/1612152?v=4)](https://github.com/theking2 "theking2 (21 commits)")[![kingma-sbw](https://avatars.githubusercontent.com/u/50140049?v=4)](https://github.com/kingma-sbw "kingma-sbw (2 commits)")

---

Tags

monolog-handler

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kingsoft-monolog-handler/health.svg)

```
[![Health](https://phpackages.com/badges/kingsoft-monolog-handler/health.svg)](https://phpackages.com/packages/kingsoft-monolog-handler)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k532.1M19.4k](/packages/laravel-framework)[symfony/monolog-bridge

Provides integration for Monolog with various Symfony components

2.6k198.8M328](/packages/symfony-monolog-bridge)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.6k38.2k](/packages/matomo-matomo)[spatie/laravel-health

Monitor the health of a Laravel application

87411.3M152](/packages/spatie-laravel-health)[spatie/flare-client-php

Send PHP errors to Flare

177156.9M21](/packages/spatie-flare-client-php)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

585.4M517](/packages/shopware-core)

PHPackages © 2026

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