Skip to content

Logging

Logging ​

Overview ​

Monolog is the logging library for PHP. It is used by Shopware to log errors and debug information. The log files are located in the var/log directory of your Shopware installation.

Configuration ​

Configuration of Monolog is done in the config/packages/prod/monolog.yaml file. The following example shows the default configuration:

yaml
monolog:
  handlers:
    main:
      type: fingers_crossed
      action_level: error
      handler: nested
      excluded_http_codes: [404, 405]
      buffer_size: 30 # How many messages should be saved? Prevent memory leaks
    business_event_handler_buffer:
      level: error
    nested:
      type: rotating_file
      path: "%kernel.logs_dir%/%kernel.environment%.log"
      level: error
    console:
      type: console
      process_psr_3_messages: false
      channels: ["!event", "!doctrine"]

Log levels ​

Monolog supports the following log levels:

  • DEBUG: Detailed debug information.
  • INFO: Interesting events. Examples: User logs in, SQL logs.
  • NOTICE: Normal but significant events.
  • WARNING: Exceptional occurrences that are not errors. Examples: Use of deprecated APIs, poor use of an API, undesirable things that are not necessarily wrong.
  • ERROR: Runtime errors that do not require immediate action but should typically be logged and monitored.
  • CRITICAL: Critical conditions. Example: Application component unavailable, unexpected exception.
  • ALERT: Action must be taken immediately. Example: Entire website down, database unavailable, etc. This should trigger the SMS alerts and wake you up.
  • EMERGENCY: Emergency: system is unusable.

Log sent e-mails and other flow events ​

To monitor all sent e-mails and other flow events set the business_event_handler_buffer to info level:

yaml
monolog:
  handlers:
    business_event_handler_buffer:
      level: info

INFO

Be aware that this will cost you some performance.

Was this page helpful?
UnsatisfiedSatisfied
Be the first to vote!
0.0 / 5  (0 votes)