diff --git a/.wordlist.txt b/.wordlist.txt index 8f8dece09..baacbbd8b 100644 --- a/.wordlist.txt +++ b/.wordlist.txt @@ -1291,6 +1291,7 @@ slowlog sm smartbar SMTP +SMS snakeCase SnippetFileInterface SomeCoreClassTest diff --git a/guides/hosting/configurations/framework/monolog.md b/guides/hosting/configurations/framework/monolog.md new file mode 100644 index 000000000..eed396455 --- /dev/null +++ b/guides/hosting/configurations/framework/monolog.md @@ -0,0 +1,48 @@ +--- +nav: + title: Monolog + position: 20 + +--- + +# Monolog + +## Overview + +Monolog is a 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: + +<<< @/docs/snippets/config/monolog.yaml + + +## 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. +::: diff --git a/snippets/config/monolog.yaml b/snippets/config/monolog.yaml new file mode 100644 index 000000000..84106c3a3 --- /dev/null +++ b/snippets/config/monolog.yaml @@ -0,0 +1,18 @@ +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"]