Skip to content

Instantly share code, notes, and snippets.

@nemishkor
Last active May 31, 2023 18:34
Show Gist options
  • Save nemishkor/afcc7e7f26377c04ffa7a2e1a61f2d12 to your computer and use it in GitHub Desktop.
Save nemishkor/afcc7e7f26377c04ffa7a2e1a61f2d12 to your computer and use it in GitHub Desktop.
logger configuration for symfony framework
monolog:
channels:
- deprecation # Deprecations are logged in the dedicated "deprecation" channel when it exists
when@dev:
monolog:
handlers:
main:
type: rotating_file
max_files: 7
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: warning
channels: ["!event"]
deprecation:
type: rotating_file
max_files: 7
path: "%kernel.logs_dir%/%kernel.environment%.deprecation.log"
level: warning
channels: ["deprecation"]
all:
type: rotating_file
max_files: 7
path: "%kernel.logs_dir%/%kernel.environment%.debug.log"
level: debug
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: rotating_file
max_files: 7
path: "%kernel.logs_dir%/%kernel.environment%.log"
level: warning
channels: ["!event"]
deprecation:
type: rotating_file
max_files: 7
path: "%kernel.logs_dir%/%kernel.environment%.deprecation.log"
level: warning
channels: ["deprecation"]
all:
type: rotating_file
max_files: 7
path: "%kernel.logs_dir%/%kernel.environment%.debug.log"
level: debug
console:
type: console
process_psr_3_messages: false
channels: ["!event", "!doctrine", "!console"]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment