Download the PHP package dziki/monolog-sentry-bundle without Composer
On this page you can find all versions of the php package dziki/monolog-sentry-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package monolog-sentry-bundle
Monolog Sentry Bundle
Bundle for appending useful data to Monolog log records like username, parsed user-agent header, host name, Symfony version, commit hash and a lot more - you can provide custom tags to be added to all your logs.
Installation
Install bundle with composer require dziki/monolog-sentry-bundle
command.
TL;DR
Comparison of exactly same error handled by default monolog raven handler with sentry/sentry
package client with bundle
turned off and on with some basic config. As you can see - after turning bundle on - browser, user,
breadcrumbs and some valuable tags showed up, making your error logs much easier to read.
Before
After
Enable the Bundle
Add entry to config/bundles.php
:
or to app/AppKernel.php
Configuration
Default configuration does nothing, You need to adjust it manually according to Your needs:
You can turn on logging user context by setting value to true
- it requires symfony/security-bundle
package.
user_agent_parser
requires valid user agent header parser service as value.
Parsing user agent takes about 0.1ms (up to 1ms using native parser) for every request, so...
Caching once parsed User Agents
Caching is supported when service implementing Psr\SimpleCache\CacheInterface
is provided under cache
config entry.
Starting from version 4.1 of Symfony there is default simple cache service cache.app.simple
, in previous versions you
need to define own service:
Custom tags
You can extend amount of logged data by adding custom tags. For example, for logging Symfony version, setting useful Sentry environment and server name you should modify config to this:
Full basic config
User Agent parser
Bundle supports two parsers:
phpuseragent
(github.com/donatj/PhpUserAgent) - as suggested packagenative
(get_browser()) - browscap configuration setting in php.ini must point to the correct location of the browscap.ini
Configurable through user_agent_parser
value, respectively phpuseragent
or native
. You can also add own, by providing
name of service implementing ParserInterface.
Hints
-
Add
stop_buffering: false
to yourfingers_crossed
handler to keep low level messages notifications as breadcrumbs: - Add Sentry handler
release
option to monolog config for easy regression seeking:
License
MonologSentryBundle is released under the MIT license.
All versions of monolog-sentry-bundle with dependencies
psr/simple-cache Version ^1.0
psr/simple-cache-implementation Version ^1.0
symfony/dependency-injection Version ^4.2|^5.0
symfony/monolog-bundle Version ^3.3
monolog/monolog Version ^1
symfony/monolog-bridge Version ^4.2|^5.0
sentry/sentry Version ^1.9.1