-
-
Notifications
You must be signed in to change notification settings - Fork 680
Description
Hello,
I upgraded my project to Symfony 8 / MonologBundle 4.
My config/packages/sentry.yaml generated using the recipe was:
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
I got the error:
Unrecognized options "hub_id, fill_extra_context" under "monolog.handlers.sentry". Available options are "accepted_levels", "action_level", "activation_strategy", "app_name", "bot_name", "bubble", "buffer_size", "channel", "channel s", "config", "connection_string", "connection_timeout", "console_formatter_options", "content_type", "date_format", "deduplication_level", "delay_between_messages", "disable_notification", "disable_webpage_preview", "document_type ", "elasticsearch", "email_prototype", "enabled", "exchange", "exchange_name", "exclude_fields", "excluded_http_codes", "facility", "factor", "file_permission", "filename_format", "flush_on_overflow", "formatter", "from_email", "ha ndler", "headers", "host", "icon_emoji", "id", "ident", "ignore_error", "include_extra", "include_stacktraces", "index", "interactive_only", "level", "logopts", "mailer", "max_files", "max_level", "members", "message_type", "min_le vel", "mongodb", "nested", "parse_mode", "passthru_level", "path", "persistent", "port", "predis", "priority", "process_psr_3_messages", "publisher", "redis", "region", "source", "split_long_messages", "stop_buffering", "store", "s ubject", "tags", "time", "timeout", "title", "to_email", "token", "topic", "type", "url", "use_attachment", "use_locking", "use_short_attachment", "use_ssl", "user", "verbosity_levels", "webhook_url".
Indeed, the sentry handler was removed in MonologBundle 4: symfony/monolog-bundle#539
So I read https://docs.sentry.io/platforms/php/guides/symfony/logs/ and updated my configuration to:
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
enable_logs: 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_logs:
type: service
id: Sentry\SentryBundle\Monolog\LogsHandler
include_extra: true # Enables sending monolog context to Sentry
process_psr_3_messages: false # Disables the resolution of PSR-3 placeholders
services:
Sentry\SentryBundle\Monolog\LogsHandler:
arguments:
- !php/const Monolog\Logger::INFO
but I am not getting any alert on sentry.io
What would be the correct new configuration?
Can someone fix the recipe?
Thanks in advance
Best regards