- StreamHandler: Logs records into any PHP stream, use this for log files.
- RotatingFileHandler: Logs records to a file and creates one log file per day.
It will also delete files older than
$maxFiles
. You should use logrotate for high profile setups though, this is just meant as a quick and dirty solution. - SyslogHandler: Logs records to the syslog.
- ErrorLogHandler: Logs records to PHP's
error_log()
function. - ProcessHandler: Logs records to the STDIN of any process, specified by a command.
- NativeMailerHandler: Sends emails using PHP's
mail()
function. - SymfonyMailerHandler: Sends emails using a
symfony/mailer
instance. - PushoverHandler: Sends mobile notifications via the Pushover API.
- FlowdockHandler: Logs records to a Flowdock account.
- SlackWebhookHandler: Logs records to a Slack account using Slack Webhooks.
- SlackHandler: Logs records to a Slack account using the Slack API (complex setup).
- SendGridHandler: Sends emails via the SendGrid API.
- MandrillHandler: Sends emails via the
Mandrill API
using aSwift_Message
instance. - FleepHookHandler: Logs records to a Fleep conversation using Webhooks.
- IFTTTHandler: Notifies an IFTTT trigger with the log channel, level name and message.
- TelegramBotHandler: Logs records to a Telegram bot account.
- HipChatHandler: Logs records to a HipChat chat room using its API. Deprecated and removed in Monolog 2.0, use Slack handlers instead, see Atlassian's announcement
- SwiftMailerHandler: Sends emails using a
Swift_Mailer
instance. Deprecated and removed in Monolog 3.0. Use SymfonyMailerHandler instead.
- SocketHandler: Logs records to sockets, use this for UNIX and TCP sockets. See an example.
- AmqpHandler: Logs records to an AMQP compatible server. Requires the php-amqp extension (1.0+) or php-amqplib library.
- GelfHandler: Logs records to a Graylog2 server. Requires package graylog2/gelf-php.
- ZendMonitorHandler: Logs records to the Zend Monitor present in Zend Server.
- NewRelicHandler: Logs records to a NewRelic application.
- LogglyHandler: Logs records to a Loggly account.
- RollbarHandler: Logs records to a Rollbar account.
- SyslogUdpHandler: Logs records to a remote Syslogd server.
- LogEntriesHandler: Logs records to a LogEntries account.
- InsightOpsHandler: Logs records to an InsightOps account.
- LogmaticHandler: Logs records to a Logmatic account.
- SqsHandler: Logs records to an AWS SQS queue.
- RavenHandler: Logs records to a Sentry server using raven. Deprecated and removed in Monolog 2.0, use sentry/sentry 2.x and the Sentry\Monolog\Handler class instead.
- FirePHPHandler: Handler for FirePHP, providing
inline
console
messages within FireBug. - ChromePHPHandler: Handler for ChromePHP, providing
inline
console
messages within Chrome. - BrowserConsoleHandler: Handler to send logs to browser's Javascript
console
with no browser extension required. Most browsers supportingconsole
API are supported.
- RedisHandler: Logs records to a redis server's key via RPUSH.
- RedisPubSubHandler: Logs records to a redis server's channel via PUBLISH.
- MongoDBHandler: Handler to write records in MongoDB via a Mongo extension connection.
- CouchDBHandler: Logs records to a CouchDB server.
- DoctrineCouchDBHandler: Logs records to a CouchDB server via the Doctrine CouchDB ODM.
- ElasticaHandler: Logs records to an Elasticsearch server using ruflin/elastica.
- ElasticsearchHandler: Logs records to an Elasticsearch server.
- DynamoDbHandler: Logs records to a DynamoDB table with the AWS SDK.
- FingersCrossedHandler: A very interesting wrapper. It takes a handler as a parameter and will accumulate log records of all levels until a record exceeds the defined severity level. At which point it delivers all records, including those of lower severity, to the handler it wraps. This means that until an error actually happens you will not see anything in your logs, but when it happens you will have the full information, including debug and info records. This provides you with all the information you need, but only when you need it.
- DeduplicationHandler: Useful if you are sending notifications or emails
when critical errors occur. It takes a handler as a parameter and will
accumulate log records of all levels until the end of the request (or
flush()
is called). At that point it delivers all records to the handler it wraps, but only if the records are unique over a given time period (60seconds by default). If the records are duplicates they are simply discarded. The main use of this is in case of critical failure like if your database is unreachable for example all your requests will fail and that can result in a lot of notifications being sent. Adding this handler reduces the amount of notifications to a manageable level. - WhatFailureGroupHandler: This handler extends the GroupHandler ignoring exceptions raised by each child handler. This allows you to ignore issues where a remote tcp connection may have died but you do not want your entire application to crash and may wish to continue to log to other handlers.
- FallbackGroupHandler: This handler extends the GroupHandler ignoring exceptions raised by each child handler, until one has handled without throwing. This allows you to ignore issues where a remote tcp connection may have died but you do not want your entire application to crash and may wish to continue to attempt logging to other handlers, until one does not throw an exception.
- BufferHandler: This handler will buffer all the log records it receives
until
close()
is called at which point it will callhandleBatch()
on the handler it wraps with all the log messages at once. This is very useful to send an email with all records at once for example instead of having one mail for every log record. - GroupHandler: This handler groups other handlers. Every record received is sent to all the handlers it is configured with.
- FilterHandler: This handler only lets records of the given levels through to the wrapped handler.
- SamplingHandler: Wraps around another handler and lets you sample records if you only want to store some of them.
- NoopHandler: This handler handles anything by doing nothing. It does not stop processing the rest of the stack. This can be used for testing, or to disable a handler when overriding a configuration.
- NullHandler: Any record it can handle will be thrown away. This can be used to put on top of an existing handler stack to disable it temporarily.
- PsrHandler: Can be used to forward log records to an existing PSR-3 logger
- TestHandler: Used for testing, it records everything that is sent to it and has accessors to read out the information.
- HandlerWrapper: A simple handler wrapper you can inherit from to create your own wrappers easily.
- OverflowHandler: This handler will buffer all the log messages it receives, up until a configured threshold of number of messages of a certain level is reached, after it will pass all log messages to the wrapped handler. Useful for applying in batch processing when you're only interested in significant failures instead of minor, single erroneous events.
- LineFormatter: Formats a log record into a one-line string.
- HtmlFormatter: Used to format log records into a human readable html table, mainly suitable for emails.
- NormalizerFormatter: Normalizes objects/resources down to strings so a record can easily be serialized/encoded.
- ScalarFormatter: Used to format log records into an associative array of scalar values.
- JsonFormatter: Encodes a log record into json.
- WildfireFormatter: Used to format log records into the Wildfire/FirePHP protocol, only useful for the FirePHPHandler.
- ChromePHPFormatter: Used to format log records into the ChromePHP format, only useful for the ChromePHPHandler.
- GelfMessageFormatter: Used to format log records into Gelf message instances, only useful for the GelfHandler.
- LogstashFormatter: Used to format log records into logstash event json, useful for any handler listed under inputs here.
- ElasticaFormatter: Used to format log records into an Elastica\Document object, only useful for the ElasticaHandler.
- ElasticsearchFormatter: Used to add index and type keys to log records, only useful for the ElasticsearchHandler.
- LogglyFormatter: Used to format log records into Loggly messages, only useful for the LogglyHandler.
- FlowdockFormatter: Used to format log records into Flowdock messages, only useful for the FlowdockHandler.
- MongoDBFormatter: Converts \DateTime instances to \MongoDate and objects recursively to arrays, only useful with the MongoDBHandler.
- LogmaticFormatter: Used to format log records to Logmatic messages, only useful for the LogmaticHandler.
- FluentdFormatter: Used to format log records to Fluentd logs, only useful with the SocketHandler.
- GoogleCloudLoggingFormatter: Used to format log records for Google Cloud Logging. It works like a JsonFormatter with some minor tweaks.
- SyslogFormatter: Used to format log records in RFC 5424 / syslog format. This can be used to output a syslog-style file that can then be consumed by tools like lnav.
- PsrLogMessageProcessor: Processes a log record's message according to PSR-3 rules, replacing
{foo}
with the value from$context['foo']
. - IntrospectionProcessor: Adds the line/file/class/method from which the log call originated.
- WebProcessor: Adds the current request URI, request method and client IP to a log record.
- MemoryUsageProcessor: Adds the current memory usage to a log record.
- MemoryPeakUsageProcessor: Adds the peak memory usage to a log record.
- ProcessIdProcessor: Adds the process id to a log record.
- UidProcessor: Adds a unique identifier to a log record.
- GitProcessor: Adds the current git branch and commit to a log record.
- MercurialProcessor: Adds the current hg branch and commit to a log record.
- TagProcessor: Adds an array of predefined tags to a log record.
- HostnameProcessor: Adds the current hostname to a log record.
Third party handlers, formatters and processors are listed in the wiki. You can also add your own there if you publish one.
← Usage | Utility classes →