Skip to content

Commit

Permalink
Add info about logging (#1239)
Browse files Browse the repository at this point in the history
* Add info about logging

* Add SMS wordlist and change MonoLog
  • Loading branch information
Isengo1989 authored Dec 21, 2023
1 parent 813fd3c commit 71dbe29
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 0 deletions.
1 change: 1 addition & 0 deletions .wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1291,6 +1291,7 @@ slowlog
sm
smartbar
SMTP
SMS
snakeCase
SnippetFileInterface
SomeCoreClassTest
Expand Down
48 changes: 48 additions & 0 deletions guides/hosting/configurations/framework/monolog.md
Original file line number Diff line number Diff line change
@@ -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.
:::
18 changes: 18 additions & 0 deletions snippets/config/monolog.yaml
Original file line number Diff line number Diff line change
@@ -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"]

0 comments on commit 71dbe29

Please sign in to comment.