# Debugging Akonadi Resources

It is possible to debug a specific akonadi resource. This is done by restarting akonadi with specific environment variables. For example to debug the EWS resource:

* [Heaptrack (memory profiler)](https://invent.kde.org/sdk/heaptrack) with `AKONADI_HEAPTRACK=akonadi_ews_resource akonadictl restart` to start the profiling and `akonadictl stop` to stop it.
* [Valgrid (dynamic memory analysis tool)](https://valgrind.org/) with the `AKONADI_VALGRIND` environment variable. By default, this uses the `memcheck` tool, but this can be changed with the `AKONADI_VALGRIND_SKIN` environment variable. More options can be passed with the `AKONADI_VALGRIND_OPTIONS` environment variable.
* [Perf (CPU profiler)](https://perf.wiki.kernel.org/index.php/Main_Page) with the `AKONADI_PERF` environment variable. This can then be visualized with [Hotspot](https://github.com/KDAB/hotspot).

This variables are defined in [akonadicontrol](https://invent.kde.org/pim/akonadi/-/blob/master/src/akonadicontrol/processcontrol.cpp?ref_type=heads#L164)

### Debugging the EWS resource

By using the following logging rules, Akonadi will dump the content of the EWS responses to a temporary directory.

```bash
QT_LOGGING_RULES="*org.kde.pim.ews*=true" akonadictl restart
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.novaflowos.com/start/kde-developer-platform/readme/features/akonadi/debugging_akonadi.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
