PHPackages                             sallyx/rabbitmq-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. sallyx/rabbitmq-logger

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

sallyx/rabbitmq-logger
======================

Log error and exceptions int rabbitmq exchange.

1.0.0(9y ago)014PHPPHP &gt;=5.4.0

Since Jun 1Pushed 5y ago1 watchersCompare

[ Source](https://github.com/sallyx/rabbitmq-logger)[ Packagist](https://packagist.org/packages/sallyx/rabbitmq-logger)[ Docs](http://github.org/sallyx/rabbitmq-logger)[ RSS](/packages/sallyx-rabbitmq-logger/feed)WikiDiscussions master Synced 2d ago

READMEChangelog (3)Dependencies (1)Versions (4)Used By (0)

Rabbitmq Logger
===============

[](#rabbitmq-logger)

Log error and exceptions int rabbitmq exchange.

[![Latest stable](https://camo.githubusercontent.com/4057c41e36822ff5677c748e07cf31c5ced1979eb43a4049eda75025a67be79e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73616c6c79782f7261626269746d712d6c6f676765722e737667)](https://packagist.org/packages/sallyx/rabbitmq-logger)

Rabbitmq Logger provides two extensions for [Nette Framework](https://github.com/nette/nette).

- **RabbitMqLoggerExtension** for logging errors/exceptions into rabbitmq exange. You should use this extension on all projects where you want to log error messages to rabbitmq.
- **ConsumerExtension** for getting messages from queue and optionally save them into database using doctrine 2. It also provide grid to show the saved messages. You should use this extension with an internal application to manage saved messages.

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

[](#installation)

### Requirements

[](#requirements)

sallyx/rabbitmq-logger requires PHP 5.4 or higher.

- [Nette](https://github.com/nette/nette)
- [Kdyby/RabbitMq](https://github.com/Kdyby/RabbitMq)
- [php-amqplib](https://github.com/videlalvaro/php-amqplib)

### Suggests

[](#suggests)

If you want to use ConsumerExtension to save logs into database:

- [Kdyby/Doctrine](https://github.com/Kdyby/Doctrine)
- [Kdyby/Console](https://github.com/Kdyby/Console)

If you want to use ConsumerExtension to provide Grid to show saved messages:

- [ublaboo/datagrid](https://github.com/ublaboo/datagrid)

### Installation

[](#installation-1)

The best way to install sallyx/rabbitmq-logger is using [Composer](http://getcomposer.org/):

```
composer require sallyx/rabbitmq-logger
composer require kdyby/console
composer require kdyby/doctrine
composer require ublaboo/datagrid
```

### Configuration

[](#configuration)

First you need to configure [Kdyby/RabbitMq](https://github.com/Kdyby/RabbitMq). A least the connection:

```
extensions:
    rabbitmq: Kdyby\RabbitMq\DI\RabbitMqExtension

rabbitmq:
    connection:
        host: localhost
        port: 5672
        user: 'guest'
        password: 'guest'
        #vhost: '/'
```

If you want to use RabbitMqLoggerExtension to log error messages, add and configure it like this:

```
extensions:
    rabbitmqLoggerExt: Sallyx\RabbitMqLogger\DI\RabbitMqLoggerExtension
```

This is the default configuration for RabbitMqLoggerExtension:

```
rabbitmqLoggerExt:
    rabbitmqEnabled: true
    rabbitmqExtensionName: rabbitmq
    guid: rabbitmq-logger                # global id of your site (use whatever you want)
    producer:
        connection: default              # Kdyby/RabbitMq default connection
        exchange:
            name: nette-log-exchange
            type: fanout
```

If you use **direct** exchange, the routing key is in form *priority*, where priority is *error* or *exception*. If you use **topic** exchange, the routing key is in form *priority*.*guid*

If you want to use ConsumerExtension, you have to add [Kdyby/Console](https://github.com/Kdyby/Console)and/or [Kdyby/Doctrine](https://github.com/Kdyby/Doctrine) extensions and configure it (please have a look at the documentation for this extensions):

```
extensions:
    rabbitmqLoggerConsumer: Sallyx\RabbitMqLogger\DI\ConsumerExtension # must be first!
    console: Kdyby\Console\DI\ConsoleExtension
    events: Kdyby\Events\DI\EventsExtension
    annotations: Kdyby\Annotations\DI\AnnotationsExtension
    doctrine: Kdyby\Doctrine\DI\OrmExtension
    rabbitmqLoggerExt: Sallyx\RabbitMqLogger\DI\RabbitMqLoggerExtension # if you want to use it either

console:
    url: http://localhost/~petr/example-url/

doctrine:
    host: 127.0.0.1
    user: petr
    password: xxx
    dbname: databasename
    driver: pdo_pgsql # pdo_mysql
```

This is the default configuration for ConsumerExtension:

```
rabbitmqLoggerConsumer:
    consumerName: rabbitLogger
    consumer:
        connection: default                   # Kdyby/RabbitMq default connection
        queue:
            name: nette-log-queue
        exchange:
            name: nette-log-exchange          # the same as for RabbitMqLoggerExtension
            type: fanout                      # the same as for RabbitMqLoggerExtension
    manager: Sallyx\RabbitMqLogger\Model\Doctrine\Manager
```

If you want to get an easy acces to your logged exceptions, you can add this to RabbitMqLoggerExtension configuration:

```
rabbitmqLoggerExt:
    exceptionFileRoute:
        route: get-tracy-exception-file
        secret: xxx
    ....
```

This create route in your web application, which provides access to your error messages saved in log in form [http://example.org/get-tracy-exception-file?secret=xxx&amp;file=name\_of\_the\_file](http://example.org/get-tracy-exception-file?secret=xxx&file=name_of_the_file)

To use this in the grid, add this to ConsumerExtension configuration:

```
rabbitmqLoggerConsumer:
    exceptionFileRoute:
        route: get-tracy-exception-file
        secret: xxx
    ....
```

Setup
-----

[](#setup)

You have to create exchange for RabbitMqLoggerExtension and queue for ConsumerExtension. If you want to use ConsumerExtension to save messages to database, you also have to create the schema and table.

If you have installed Kdyby/Console, you can use *rabbitmq:setup-fabric* command from Kdyby/RabbitMq extension to setup exchange and queue:

```
php www/index.php  rabbitmq:setup-fabric
```

To create the database table, you can use [structure-psql.sql](src/setup/doctrine/structure-psql.sql) for Postgresql and [structure-mysql.sql](src/setup/doctrine/structure-mysql.sql) for Mysql/MariaDB.

Using RabbitMqLoggerExtension
-----------------------------

[](#using-rabbitmqloggerextension)

No futher action needed. Your project should log messages into rabbitmq exhange as configured.

Using ConsumerExtension
-----------------------

[](#using-consumerextension)

### Using Console

[](#using-console)

If you installed Kdyby/Console extension, you can use this commands:

- **rabbitmqLoggerConsumer:queue** to add or delete other queues to exchange.
- **rabbitmqLoggerConsumer:list** to list and remove messages from queue.
- **rabbitmqLoggerConsumer:save** to list, save messages to database and remove from queue (Kdyby/Doctine extension needed).

While *rabbitmqLoggerConsumer:save* takes messages from queue described in configuration, *rabbitmqLoggerConsumer:list* require queue name as argument to avoid accidentally removing message from queue. You can use *rabbitmqLoggerConsumer:queue* to create new queue.

```
php www/index.php rabbitmqLoggerConsumer:queue spy-whats-going-on exception  # create queue for 'exception' routing key
php www/index.php rabbitmqLoggerConsumer:list spy-whats-going-on        # print message and remove it from queue
....
php www/index.php rabbitmqLoggerConsumer:queue spy-whats-going-on -d    # delete queue
```

### Using Grid

[](#using-grid)

In a presenter:

```
use Sallyx\RabbitMqLogger\Controls\Doctrine\GridFactory;
...

   public function __construct(GridFactory $factory) {
        $this->gridFactory = $factory;
   }

    public function createComponentGrid($name) {
        return $this->gridFactory->create();
    }
```

In latte:

```
{control grid}
```

You need to add assets as described on  page.

Result:

[![Ublaboo datagrid](assets/ublaboo-grid-thumb.png)](assets/ublaboo-grid-thumb.png)

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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 ~6 days

Total

3

Last Release

3304d ago

Major Versions

0.9.2 → 1.0.02017-06-13

### Community

Maintainers

![](https://www.gravatar.com/avatar/521447ca813bc89fb2ef2780a06a5acf931c474beedcbed786838372a55d292a?d=identicon)[sallyx](/maintainers/sallyx)

---

Top Contributors

[![sallyx](https://avatars.githubusercontent.com/u/4263901?v=4)](https://github.com/sallyx "sallyx (7 commits)")

---

Tags

loggingnetterabbitmq

### Embed Badge

![Health badge](/badges/sallyx-rabbitmq-logger/health.svg)

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

###  Alternatives

[psr/log

Common interface for logging libraries

10.4k1.2B10.9k](/packages/psr-log)[open-telemetry/api

API for OpenTelemetry PHP.

1938.5M263](/packages/open-telemetry-api)[open-telemetry/sdk

SDK for OpenTelemetry PHP.

2326.5M317](/packages/open-telemetry-sdk)[illuminated/console-logger

Logging and Notifications for Laravel Console Commands.

8676.7k](/packages/illuminated-console-logger)

PHPackages © 2026

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