PHPackages                             contaoblackforest/contao-logger - 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. contaoblackforest/contao-logger

AbandonedContao-module[Logging &amp; Monitoring](/categories/logging)

contaoblackforest/contao-logger
===============================

PSR-3 logger bridge for Contao Open Source CMS

2.0.1(10y ago)02.2k14LGPL-3.0+PHPPHP &gt;=5.3

Since Dec 17Pushed 3y ago2 watchersCompare

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

READMEChangelogDependencies (17)Versions (6)Used By (4)

[![Build Status](https://camo.githubusercontent.com/29e0e1ccc94e1ec24a2c6aa21f2ba597c0104451cb5180743185504f6dc79fa9/68747470733a2f2f7472617669732d63692e6f72672f436f6e74616f426c61636b466f726573742f636f6e74616f2d6c6f676765722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/ContaoBlackForest/contao-logger)

Logger bridge for Contao Open Source CMS
========================================

[](#logger-bridge-for-contao-open-source-cms)

This bridge provide PSR-3 logger support for [Contao Open Source CMS](http://contao.org). The logger is available via the [dependency injection container](https://github.com/contao-community-alliance/dependency-container).

By default the logger use two handlers.

- An contao syslog handler, that write log entries to the system log database.
- And an stream handler, that write log entries to `system/logs/contao.log`.

By default it use [Monolog](https://github.com/Seldaek/monolog) as implementation, but it is designed to be replaceable with any PSR-3 compatible logger implementation.

Access and use the logger
-------------------------

[](#access-and-use-the-logger)

```
global $container;

/** @var \Psr\Log\LoggerInterface */
$logger = $container['logger'];
$logger->emergency('Some extreme critical message');
```

Logger configuration
--------------------

[](#logger-configuration)

### Receive and change the default log level

[](#receive-and-change-the-default-log-level)

```
global $container;

// receive default log level
$level = $container['logger.default.level'];

// change default log level
$container['logger.default.level'] = \Psr\Log\LogLevel::WARNING;
```

### Define default log handlers

[](#define-default-log-handlers)

The default log handlers are stored in `$container['logger.default.handlers']` containing a list of handler services.

```
global $container;

// receive the default log handlers array (its an ArrayObject instance)
$handlers = $container['logger.default.handlers'];

// remove the contao syslog handler
foreach ($handlers as $index => $serviceKey) {
	if ($serviceKey == 'logger.handler.contao') {
		unset($handlers[$index]);
		break;
	}
}

// add a custom handler
$container['logger.handler.custom'] = function($container) {
	$factory = $container['logger.factory.handler.stream'];
	// store in /var/log/critical.log
	return $factory('/var/log/critical.log', \Psr\Log\LogLevel::CRITICAL);
}
$handlers->append('logger.handler.custom');
```

### Create your own logger

[](#create-your-own-logger)

```
global $container;

// register a handler
$container['logger.handler.custom'] = function($container) {
	$factory = $container['logger.factory.handler.stream'];
	// store in system/logs/critical.log
	return $factory('critical.log', \Monolog\Logger::CRITICAL);
}

// register your logger
$container['logger.custom'] = function($container) {
	// using the logger factory
	$factory = $container['logger.factory'];
	$logger = $factory('contao', array('logger.handler.custom'));

	return $logger;
};

// receive your logger
$logger = $container['logger.custom'];
```

Reference
=========

[](#reference)

Services
--------

[](#services)

### `$container['logger.default.level']`

[](#containerloggerdefaultlevel)

(`int`) the default log level, default: `Psr\Log\LogLevel::INFO`

### `$container['logger.default.level.contao']`

[](#containerloggerdefaultlevelcontao)

(`int`) the default log level, inherited from `$container['logger.default.level']`

### `$container['logger.default.level.buffer']`

[](#containerloggerdefaultlevelbuffer)

(`int`) the default log level, inherited from `$container['logger.default.level']`

### `$container['logger.default.level.chromePhp']`

[](#containerloggerdefaultlevelchromephp)

(`int`) the default log level, inherited from `$container['logger.default.level']`

### `$container['logger.default.level.firePhp']`

[](#containerloggerdefaultlevelfirephp)

(`int`) the default log level, inherited from `$container['logger.default.level']`

### `$container['logger.default.level.rotatingFile']`

[](#containerloggerdefaultlevelrotatingfile)

(`int`) the default log level, inherited from `$container['logger.default.level']`

### `$container['logger.default.level.mail']`

[](#containerloggerdefaultlevelmail)

(`int`) the default log level, default: `Psr\Log\LogLevel::ERROR`

### `$container['logger.default.level.stream']`

[](#containerloggerdefaultlevelstream)

(`int`) the default log level, inherited from `$container['logger.default.level']`

### `$container['logger.default.rotation']`

[](#containerloggerdefaultrotation)

(`int`) number of days for log rotation, default: 28

### `$container['logger.handler.contao']`

[](#containerloggerhandlercontao)

(`Monolog\Handler\HandlerInterface|Logger\ContaoHandler`) default contao syslog handler

### `$container['logger.handler.stream']`

[](#containerloggerhandlerstream)

(`Monolog\Handler\HandlerInterface|Monolog\Handler\RotatingFileHandler`) default rotating logfile (system/logs/contao-Y-m-d.log) handler

### `$container['logger.default.handlers']`

[](#containerloggerdefaulthandlers)

(`ArrayObject`) list of default log handlers

### `$container['logger']`

[](#containerlogger)

(`Psr\Log\LoggerInterface|Monolog\Logger`) the default logger

Factories
---------

[](#factories)

### `$container['logger.factory.handler.contao']`

[](#containerloggerfactoryhandlercontao)

```
/**
 * @param int    $level    The minimum logging level at which this handler will be triggered
 * @param bool   $bubble   Whether the messages that are handled can bubble up the stack or not
 * @param string $function The function name in the contao syslog (use channel name by default)
 * @param string $action   The action name in the contao syslog (use simplified log level name by default)
 */
function($level = null, $bubble = true, $function = null, $action = null)
```

### `$container['logger.factory.handler.buffer']`

[](#containerloggerfactoryhandlerbuffer)

```
/**
 * @param string|callable|Monolog\Handler\HandlerInterface $handler         Service name, callable or handler object.
 * @param int                                              $bufferSize      How many entries should be buffered at most, beyond that the oldest items are removed from the buffer.
 * @param int                                              $level           The minimum logging level at which this handler will be triggered
 * @param bool                                             $bubble          Whether the messages that are handled can bubble up the stack or not
 * @param bool                                             $flushOnOverflow If true, the buffer is flushed when the max size has been reached, by default oldest entries are discarded
 */
function function($handler, $bufferSize = 0, $level = null, $bubble = true, $flushOnOverflow = false)
```

### `$container['logger.factory.handler.chromePhp']`

[](#containerloggerfactoryhandlerchromephp)

```
/**
 * @param int  $level  The minimum logging level at which this handler will be triggered
 * @param bool $bubble Whether the messages that are handled can bubble up the stack or not
 */
function function($level = null, $bubble = true)
```

### `$container['logger.factory.handler.fingersCrossed']`

[](#containerloggerfactoryhandlerfingerscrossed)

```
/**
 * @param string|callable|Monolog\Handler\HandlerInterface $handler            Service name, callable or handler object.
 * @param int|ActivationStrategyInterface                  $activationStrategy The minimum logging level at which this handler will be triggered
 * @param int                                              $bufferSize         How many entries should be buffered at most, beyond that the oldest items are removed from the buffer.
 * @param bool                                             $bubble             Whether the messages that are handled can bubble up the stack or not
 * @param bool                                             $stopBuffering      Whether the handler should stop buffering after being triggered (default true)
 */
function function($handler, $activationStrategy = null, $bufferSize = 0, $bubble = true, $stopBuffering = true)
```

### `$container['logger.factory.handler.firePhp']`

[](#containerloggerfactoryhandlerfirephp)

```
/**
 * @param int  $level  The minimum logging level at which this handler will be triggered
 * @param bool $bubble Whether the messages that are handled can bubble up the stack or not
 */
function function($level = null, $bubble = true)
```

### `$container['logger.factory.handler.group']`

[](#containerloggerfactoryhandlergroup)

```
/**
 * @param array $handlers List of services, callbacks or handlers.
 * @param bool  $bubble   Whether the messages that are handled can bubble up the stack or not
 */
function function(array $handlers, $bubble = true)
```

### `$container['logger.factory.handler.rotatingFile']`

[](#containerloggerfactoryhandlerrotatingfile)

```
/**
 * @param string $filename Absolute filename or single name (stored in system/logs/)
 * @param int    $maxFiles The maximal amount of files to keep (0 means unlimited)
 * @param int    $level  The minimum logging level at which this handler will be triggered
 * @param bool   $bubble Whether the messages that are handled can bubble up the stack or not
 */
function function($filename, $maxFiles = null, $level = null, $bubble = true)
```

### `$container['logger.factory.handler.mail']`

[](#containerloggerfactoryhandlermail)

```
/**
 * A handler using swift to send entries as emails.
 *
 * @param string $to      The email recipient address
 * @param string $subject The email subject
 * @param string $from    The email sender address
 * @param int    $level   The minimum logging level at which this handler will be triggered
 * @param bool   $bubble  Whether the messages that are handled can bubble up the stack or not
 */
function function($to = null, $subject = null, $from = null, $level = null, $bubble = true)
```

### `$container['logger.factory.handler.stream']`

[](#containerloggerfactoryhandlerstream)

```
/**
 * @param string $uri    Stream uri
 * @param int    $level  The minimum logging level at which this handler will be triggered
 * @param bool   $bubble Whether the messages that are handled can bubble up the stack or not
 */
function function($uri, $level = null, $bubble = true)
```

### `$container['logger.factory']`

[](#containerloggerfactory)

```
/**
 * @param string $name     The channel name
 * @param array  $handlers List of services or handlers.
 */
function function($name, array $handlers = array())
```

###  Health Score

32

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 94.7% 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 ~175 days

Total

4

Last Release

4008d ago

Major Versions

1.1.1 → 2.0.02014-12-01

### Community

Maintainers

![](https://www.gravatar.com/avatar/233a03a2e2f9a5043fc57a6bf4ae998a2364a64a18a1263bdc11167ffb86cba8?d=identicon)[baumannsven](/maintainers/baumannsven)

![](https://www.gravatar.com/avatar/267ed97e6ff0d8bfb21dc496315426148362bf7cac913c824501d7ed97cd1c41?d=identicon)[dtomasi](/maintainers/dtomasi)

---

Top Contributors

[![tristanlins](https://avatars.githubusercontent.com/u/343404?v=4)](https://github.com/tristanlins "tristanlins (36 commits)")[![baumannsven](https://avatars.githubusercontent.com/u/2493263?v=4)](https://github.com/baumannsven "baumannsven (1 commits)")[![dtomasi](https://avatars.githubusercontent.com/u/1616726?v=4)](https://github.com/dtomasi "dtomasi (1 commits)")

---

Tags

psr-3loggercontao

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/contaoblackforest-contao-logger/health.svg)

```
[![Health](https://phpackages.com/badges/contaoblackforest-contao-logger/health.svg)](https://phpackages.com/packages/contaoblackforest-contao-logger)
```

###  Alternatives

[analog/analog

Fast, flexible, easy PSR-3-compatible PHP logging package with dozens of handlers.

3451.5M24](/packages/analog-analog)[inpsyde/wonolog

Monolog-based logging package for WordPress.

183617.9k7](/packages/inpsyde-wonolog)[apix/log

Minimalist, thin and fast PSR-3 compliant (multi-bucket) logger.

511.0M18](/packages/apix-log)[bref/logger

All you need to log with Bref on AWS Lambda

331.5M8](/packages/bref-logger)[markrogoyski/simplelog-php

Powerful PSR-3 logging. So easy, it's simple.

2818.1k4](/packages/markrogoyski-simplelog-php)[wa72/simplelogger

Wa72SimpleLogger is a collection of very simple loggers implementing \\Psr\\Log\\LoggerInterface (PSR-3)

13246.6k13](/packages/wa72-simplelogger)

PHPackages © 2026

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