feat: sentry integration
This commit is contained in:
63
config/packages/monolog.yaml
Normal file
63
config/packages/monolog.yaml
Normal file
@@ -0,0 +1,63 @@
|
||||
monolog:
|
||||
channels:
|
||||
- deprecation # Deprecations are logged in the dedicated "deprecation" channel when it exists
|
||||
|
||||
when@dev:
|
||||
monolog:
|
||||
handlers:
|
||||
main:
|
||||
type: stream
|
||||
path: "%kernel.logs_dir%/%kernel.environment%.log"
|
||||
level: debug
|
||||
channels: ["!event"]
|
||||
# uncomment to get logging in your browser
|
||||
# you may have to allow bigger header sizes in your Web server configuration
|
||||
#firephp:
|
||||
# type: firephp
|
||||
# level: info
|
||||
#chromephp:
|
||||
# type: chromephp
|
||||
# level: info
|
||||
console:
|
||||
type: console
|
||||
process_psr_3_messages: false
|
||||
channels: ["!event", "!doctrine", "!console"]
|
||||
|
||||
when@test:
|
||||
monolog:
|
||||
handlers:
|
||||
main:
|
||||
type: fingers_crossed
|
||||
action_level: error
|
||||
handler: nested
|
||||
excluded_http_codes: [404, 405]
|
||||
channels: ["!event"]
|
||||
nested:
|
||||
type: stream
|
||||
path: "%kernel.logs_dir%/%kernel.environment%.log"
|
||||
level: debug
|
||||
|
||||
when@prod:
|
||||
monolog:
|
||||
handlers:
|
||||
main:
|
||||
type: fingers_crossed
|
||||
action_level: error
|
||||
handler: nested
|
||||
excluded_http_codes: [404, 405]
|
||||
channels: ["!deprecation"]
|
||||
buffer_size: 50 # How many messages should be saved? Prevent memory leaks
|
||||
nested:
|
||||
type: stream
|
||||
path: php://stderr
|
||||
level: debug
|
||||
formatter: monolog.formatter.json
|
||||
console:
|
||||
type: console
|
||||
process_psr_3_messages: false
|
||||
channels: ["!event", "!doctrine"]
|
||||
deprecation:
|
||||
type: stream
|
||||
channels: [deprecation]
|
||||
path: php://stderr
|
||||
formatter: monolog.formatter.json
|
||||
36
config/packages/sentry.yaml
Normal file
36
config/packages/sentry.yaml
Normal file
@@ -0,0 +1,36 @@
|
||||
when@prod:
|
||||
sentry:
|
||||
dsn: '%env(SENTRY_DSN)%'
|
||||
options:
|
||||
# Add request headers, cookies, IP address and the authenticated user
|
||||
# see https://docs.sentry.io/platforms/php/data-management/data-collected/ for more info
|
||||
# send_default_pii: true
|
||||
ignore_exceptions:
|
||||
- 'Symfony\Component\ErrorHandler\Error\FatalError'
|
||||
- 'Symfony\Component\Debug\Exception\FatalErrorException'
|
||||
#
|
||||
# # If you are using Monolog, you also need this additional configuration to log the errors correctly:
|
||||
# # https://docs.sentry.io/platforms/php/guides/symfony/#monolog-integration
|
||||
register_error_listener: false
|
||||
register_error_handler: false
|
||||
#
|
||||
monolog:
|
||||
handlers:
|
||||
# # Use this only if you don't want to use structured logging and instead receive
|
||||
# # certain log levels as errors.
|
||||
# sentry:
|
||||
# type: sentry
|
||||
# level: !php/const Monolog\Logger::ERROR
|
||||
# hub_id: Sentry\State\HubInterface
|
||||
# fill_extra_context: true # Enables sending monolog context to Sentry
|
||||
# process_psr_3_messages: false # Disables the resolution of PSR-3 placeholders
|
||||
#
|
||||
# # Use this for structured log integration
|
||||
sentry_logs:
|
||||
type: service
|
||||
id: Sentry\SentryBundle\Monolog\LogsHandler
|
||||
#
|
||||
services:
|
||||
Sentry\SentryBundle\Monolog\LogsHandler:
|
||||
arguments:
|
||||
- !php/const Monolog\Logger::INFO
|
||||
Reference in New Issue
Block a user