PHPackages                             nti/log-bundle - 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. nti/log-bundle

ActiveSymfony-bundle[Logging &amp; Monitoring](/categories/logging)

nti/log-bundle
==============

Symfony NTILogBundle

v3.0.0(1y ago)13.9k1[2 issues](https://github.com/ntidev/LogBundle/issues)MITPHP

Since Dec 13Pushed 1y ago7 watchersCompare

[ Source](https://github.com/ntidev/LogBundle)[ Packagist](https://packagist.org/packages/nti/log-bundle)[ RSS](/packages/nti-log-bundle/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (1)Versions (14)Used By (0)

NTILogBundle
============

[](#ntilogbundle)

### Installation

[](#installation)

1. Install the bundle using composer:

```
$ composer require ntidev/log-bundle "dev-master"

```

2. Add the bundle configuration to the AppKernel

```
public function registerBundles()
{
    $bundles = array(
        ...
        new NTI\LogBundle\NTILogBundle(),
        ...
    );
}

```

3. Setup the configuration in the `config.yml`

```
# NTI
nti_log:
    exclude: [ 'JMose\CommandSchedulerBundle\Entity\ScheduledCommand' ]     # default: []

```

The `exclude` allows you to exclude logging for specific entities that change at a rapid rate (for example the User entity usually registers changes when users log in)

4. Update the database schema

```
$ php app/console doctrine:schema:update

```

### Usage

[](#usage)

1. Get the Logging service

```
$logger = $container->get('nti.logger');

```

The following methods are available for logging:

```
logNotice($message, $action = Log::ACTION_INFO, $entity = null)
logSuccess($message, $action = Log::ACTION_INFO, $entity = null)
logWarning($message, $action = Log::ACTION_INFO, $entity = null)
logDebug($message, $action = Log::ACTION_DEBUG, $entity = null)
logError($message, $action = Log::ACTION_INFO, $entity = null)
logException(\Exception $ex)
logSlack($message, $level = Log::LEVEL_NOTICE, $entity = null)

```

Example:

```
$service->logDebug("Hello World")

```

### Event Listeners

[](#event-listeners)

The bundle comes with 2 event subscribers: `DoctrineEventSubscriber` and `KernelExceptionListerner`.

The `DoctrineEventSubscriber` will listener for the following events:

- PostPersist
- PostUpdate
- PostRemove

And it will log the changes automatically into the database.

The `KernelExceptionListener` will capture all exceptions and log them into the database as well. However, if you capture an exception you must manually log it with the service, for example:

```
try {
    ...
    $em->flush()
} catch(\Exception $ex) {
    $this->get('nti.logger')->logException($ex);
    ...
}

```

### Slack Integration

[](#slack-integration)

If the [NexySlackBundle](https://github.com/nexylan/slack-bundle "https://github.com/nexylan/slack-bundle") is used, you can integrate this bundle to throw the information to a channel in Slack as well.

The configuration piece as shown above serves to configure how the NTILogBundle should post to Slack:

```
# NTI
nti_log:
    ...
    # In case NexySlackBundle is used
    nexy_slack:
        enabled:    # default: false
        replicate_logs: true     # default: false
        replicate_levels: [ERROR, DEBUG]   # default: [ERROR]
        channel: "#alertchannel"  # default: empty, required

# NexySlackBundle
nexy_slack:
    # The Slack API Incoming WebHooks URL.
    endpoint: "[see https://api.slack.com/tokens to generate the webhook for this app]"

```

Todo
----

[](#todo)

- Make the entity configurable and also the property used to get the username

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 57.9% 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 ~255 days

Recently: every ~307 days

Total

12

Last Release

633d ago

Major Versions

v1.8.0 → 2.0.02022-10-13

2.0.0 → v3.0.02024-08-19

### Community

Maintainers

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

---

Top Contributors

[![bvisonl](https://avatars.githubusercontent.com/u/4421747?v=4)](https://github.com/bvisonl "bvisonl (11 commits)")[![angelbencosme](https://avatars.githubusercontent.com/u/6846866?v=4)](https://github.com/angelbencosme "angelbencosme (8 commits)")

---

Tags

LogBundle

### Embed Badge

![Health badge](/badges/nti-log-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/nti-log-bundle/health.svg)](https://phpackages.com/packages/nti-log-bundle)
```

###  Alternatives

[theorchard/monolog-cascade

Monolog extension to configure multiple loggers in the blink of an eye and access them from anywhere

1482.2M9](/packages/theorchard-monolog-cascade)[rollbar/rollbar-php-symfony-bundle

Bundle for Symfony that integrates Rollbar tracker

291.4M](/packages/rollbar-rollbar-php-symfony-bundle)[api-platform/symfony

Symfony API Platform integration

323.2M67](/packages/api-platform-symfony)[api-platform/state

API Platform state interfaces

223.4M57](/packages/api-platform-state)[api-platform/serializer

API Platform core Serializer

223.4M31](/packages/api-platform-serializer)[api-platform/validator

API Platform validator component

223.2M10](/packages/api-platform-validator)

PHPackages © 2026

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