Files
Lesstime/config/packages/monolog.yaml
T
matthieu 4e7f339dc1
Pull Request — Quality gate / Frontend (build) (pull_request) Successful in 43s
Pull Request — Quality gate / Backend (PHP CS + PHPUnit) (pull_request) Has been cancelled
feat(sentry) : remonte les logs ERROR+ backend vers GlitchTip
Ajout d'un handler Monolog (Sentry\Monolog\Handler) qui envoie les logs
de niveau ERROR et plus a GlitchTip en tant qu'Issues, en prod uniquement.

- monolog.yaml : handler 'sentry' hors fingers_crossed (envoi immediat),
  canaux event/doctrine/deprecation exclus pour limiter le bruit.
- sentry.yaml : enregistrement du service handler au niveau Error +
  register_error_listener passe a false pour eviter le doublon d'exceptions
  (les exceptions kernel sont deja logguees par Symfony => remontees via Monolog).
  register_error_handler reste actif (erreurs fatales PHP).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-28 11:34:06 +02:00

64 lines
2.0 KiB
YAML

monolog:
channels:
- deprecation
when@dev:
monolog:
handlers:
main:
type: rotating_file
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
max_files: 7
channels: ["!event"]
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
nested:
type: rotating_file
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: debug
max_files: 30
console:
type: console
process_psr_3_messages: false
channels: ["!event", "!doctrine"]
deprecation:
type: rotating_file
channels: [deprecation]
path: "%kernel.logs_dir%/deprecations.log"
max_files: 7
# Remonte les logs ERROR+ vers GlitchTip en tant qu'Issues (service defini
# dans sentry.yaml). Hors fingers_crossed : envoi immediat, independamment
# du buffer fichier. On exclut le bruit (event, doctrine, deprecation).
sentry:
type: service
id: Sentry\Monolog\Handler
channels: ["!event", "!doctrine", "!deprecation"]