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)0215↓100%[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 1mo 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 65% of packages

Maintenance44

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity47

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

436d ago

Major Versions

0.1.1 → 1.0.02024-02-06

### Community

Maintainers

![](https://www.gravatar.com/avatar/14e94b3b6471915120d2c866622251509c7573ae993f65e6f622c9047bff5c62?d=identicon)[kingsoft](/maintainers/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

[symfony/monolog-bridge

Provides integration for Monolog with various Symfony components

2.6k189.7M257](/packages/symfony-monolog-bridge)[spatie/laravel-health

Monitor the health of a Laravel application

85810.0M83](/packages/spatie-laravel-health)[rollbar/rollbar

Monitors errors and exceptions and reports them to Rollbar

33723.7M81](/packages/rollbar-rollbar)[illuminate/log

The Illuminate Log package.

6224.3M517](/packages/illuminate-log)[honeybadger-io/honeybadger-php

Honeybadger PHP library

381.5M4](/packages/honeybadger-io-honeybadger-php)[graycore/magento2-stdlogging

A Magento 2 module that changes all logging handlers to stdout

2382.6k](/packages/graycore-magento2-stdlogging)

PHPackages © 2026

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