Check out our guides and API reference documentation on how to use Rollbar to monitor, debug, and triage errors.

Guides & SDKs    API Reference


How to use rollbar-php with Monolog

Monolog 1.x

Here is an example of how to use Rollbar as a handler for Monolog 1.x:


$logger = new Logger('ExampleMonologLogger');
$logger->pushHandler(new PsrHandler(Rollbar::logger()));
$logger->error(new \Exception("Example exception logged by Monolog."));

You can see a full example here:

Monolog 2.x

For Monolog 2, there is a dedicated handler included in the Monolog package:

use Monolog\Handler\RollbarHandler;

$log = new Logger('general');
$log->pushHandler(new RollbarHandler(Rollbar::logger()), Logger::DEBUG);


For more information on rollbar-php, please see the docs here.

Updated about a year ago


How to use rollbar-php with Monolog

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.