> For the complete documentation index, see [llms.txt](https://innuendopi.gitbook.io/brautomat32/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://innuendopi.gitbook.io/brautomat32/log.md).

# Logging

![media](https://4263638218-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fcd8WaQiNhLpQ99hwjXzs%2Fuploads%2Fgit-blob-dc208128fc6ea9531f3b299918689f8a6b767f1d%2Flogging.jpg?alt=media)

Logging is available in development builds. It helps with troubleshooting firmware issues and configuration errors.

A serial monitor is required. The examples below use Microsoft Visual Studio Code with the Microsoft Serial Monitor extension.

Set serial monitor to:

* baud rate `115200`
* line ending `CRLF`

![Microsoft Visual Studio Code](https://4263638218-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fcd8WaQiNhLpQ99hwjXzs%2Fuploads%2Fgit-blob-3f8ecee29d2734b048ca57ec12b15cab5a555d73%2Fvscode.jpg?alt=media)

## Logging settings

You can enable serial logging channels in system settings:

* Configuration - read/write config messages
* Sensors - sensor messages
* Actors - actuator messages
* Mash kettle - messages for kettle 1
* Brew kettle - messages for kettle 2
* NACHGUSS kettle - messages for kettle 3
* Fermenter - fermenter mode messages
* System - general system messages
* Mashing process - mash process events
* Nextion Display - display messages

Each channel supports `off`, `error`, `info`, `verbose`.

### Off

No output for this channel.

### Error

Only error messages.

```json
[E][SENSOREN.cpp:1600] setSenErr(): Test sensor error: #0 Sensor_Sud error state: 1
[E][SENSOREN.cpp:76] Update(): Sen: Sensor_Sud error #1 could not read temperature data
```

### Info

Error messages plus process information.

```json
[I][KETTLES.cpp:2044] debConsole(): set new powerlast: 1071746ms
[I][KETTLES.cpp:1922] webhook(): webhook response:
[I][KETTLES.cpp:2044] debConsole(): webhook on: 5000ms (mDutyCycle 5000 * Power 100 / 100)
```

### Verbose

Includes error + info and full diagnostic output, including SSE broadcasts.

```json
[V][SYSTEM.cpp:847] SSEBroadcastJson(): kettle hlt: {"ison":false,"state":false,"power":0,"enabled":3,"setp":0,"temp":"32.4"}
[V][SYSTEM.cpp:919] SSEBroadcastJson(): kettle sud: {"ison":false,"state":false,"power":0,"enabled":3,"setp":0,"temp":"32.4"}
[V][SYSTEM.cpp:839] SSEBroadcastJson(): kettle mash: {"power":0,"stepnr":0,"tempvalue":"50.4","target":0,"step":6,"timer":3}
```

System verbose logging also prints curl-like web server request traces.

## Log line format

Example:

```json
[V][SYSTEM.cpp:839] SSEBroadcastJson(): kettle mash: {"power":0,"stepnr":0,"tempvalue":"50.4","target":0,"step":6,"timer":3}
```

Parts:

```json
[V] output type (Verbose)
```

```json
[SYSTEM.cpp:839] source file and line
```

```json
SSEBroadcastJson(): calling function
```

Message payload:

```json
kettle mash: {"power":0,"stepnr":0,"tempvalue":"50.4","target":0,"step":6,"timer":3}
```

## Boot log example

```json
05:42:16.904 > [I][SYSINFO] starting Brautomat32 V 1.60.x Release
05:42:22.467 > [I][SYSINFO] mount filesystem LittleFS: ok, free heap mem: 192924
05:42:28.384 > [I][SYSINFO] mDNS http://Brautomat.local IP address 192.168.100.112 time: 05:42:27 RSSI: -83
```

This shows firmware version, mDNS host, IP, and filesystem mount status.

## Test sensor error

You can trigger a test sensor error via URL. Sensors use IDs starting at `0`.

```json
http://Brautomat.local/setSenErr?id=0
```

Open the same URL again to clear the error.

* sensor 1 -> `id=0`
* sensor 2 -> `id=1`
* sensor 3 -> `id=2`

This is useful for testing `Behavior in case of sensor error`.

## Logging with Microsoft VSCode

You can run VSCode in portable mode.

Download ZIP: [Microsoft VSCode](https://code.visualstudio.com/docs/?dv=winzip)

1. Extract ZIP into any folder.
2. Create a folder named `data` next to `Code.exe`.
3. Start `Code.exe`.

![Microsoft Visual Studio Code](https://4263638218-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fcd8WaQiNhLpQ99hwjXzs%2Fuploads%2Fgit-blob-4e95d60fefc88d4a47680a27b1c243557b8d6733%2Fvscode_4.jpg?alt=media)

Install extension `Serial Monitor` by Microsoft.

![Microsoft Visual Studio Code](https://4263638218-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fcd8WaQiNhLpQ99hwjXzs%2Fuploads%2Fgit-blob-02f01415280dd2126c34b996c834a4214e15069a%2Fvscode_1.jpg?alt=media) ![Microsoft Visual Studio Code](https://4263638218-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fcd8WaQiNhLpQ99hwjXzs%2Fuploads%2Fgit-blob-accb5482b7d8c3e7bd60a2c6d5f0ae157e32fbe7%2Fvscode_2.jpg?alt=media)

Open output (`Ctrl+Shift+U`), select `Serial Monitor`, then choose COM port and `115200` baud. Start with `Start Monitoring`.

![Microsoft Visual Studio Code](https://4263638218-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fcd8WaQiNhLpQ99hwjXzs%2Fuploads%2Fgit-blob-0c060350c798d5bad0af05ba8aeef3e9fe768cd2%2Fvscode_3.jpg?alt=media)
