Sends your logs to files, sockets, inboxes, databases and various web services

1.24.0 2018-11-20 17:35 UTC


Monolog sends your logs to files, sockets, inboxes, databases and various web services.

This is a fork from ( with the following features:

  • Adds MySQL database support through:
    • PDO extension (PDOHandler).
    • mysqli extension (MySQLiHandler).


Install the latest version with

$ composer require moharam82/monolog

Basic Usage


use Monolog\Logger;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\PDOHandler;
use Monolog\Handler\MySQLiHandler;

// database table to be created to store logs, if not provided will default to monolog
$table = 'logs';

// create a log channel
$log = new Logger('name');

// add a file handler to the logger
$log->pushHandler(new StreamHandler('path/to/your.log', Logger::WARNING));

// add PDO as a handler to the logger
$log->pushHandler(new PDOHandler(\PDO $pdo, $table, Logger::WARNING, true));

// add mysqli as a handler to the logger
$log->pushHandler(new MySQLiHandler(\mysqli $mysqli, $table, Logger::WARNING, true));

// add records to the log
$log->warn('Test log message');

For the original README visit (

Changelog 1.24.0 (2018-11-20)

  • Updated the monolog library to version 1.24.0
  • Updated the PDOHandler & MySQLiHandler to create a new logs table structure.
  • The table name parameter now comes second after the database connection object, so pay attention when instantiating the handler object.

For the complete v1.24.0 changelog see (