Writing logs to syslog with PHP and Monolog on Mac OS

Oleg Posyniak · June 19, 2018

Most *nix-based sustems support syslog storage for different types of system logs. On Mac OS it’s also present and we can use it.

Monolog

Syslog implementation exists as part of Syslog Handler

To use it let’c create Monolog object and configure handler:

    $monolog = new Monolog('default');
    $monolog->pushHandler(
        new SyslogHandler('My log')
    );

Console

Once you configure this handler, open Console application and filter by:

  • library: php

You will see something like this:

Console

** Note

If you do not see debug messages, go to Action -> Enable Debug Messages

Twitter, Facebook