---
title: "Debugging"
manual: "Kitodo.Presentation"
version: "dev-demo"
source: "Developers/Debugging.rst"
rendered: "2026-09-27T16:21:24+00:00"
---

# Debugging {#debugging}

Kitodo.Presentation allows developers to debug their code by calling the debug functions, which outputs in a human-readable format.

## Database Queries {#database-queries}

The SQL queries executed by the database connection can be logged by calling the `activateDebugMode()` function from the repositories. This will output the queries in the frontend, which can be useful for debugging and optimizing database interactions.

```php
public function activateDebugMode(): void
{
    $this->debug = true;
}
```

```php
protected function debugQuery(QueryInterface $query): void
{
    if ($this->debug) {
        $typo3DbQueryParser = GeneralUtility::makeInstance(Typo3DbQueryParser::class);
        $queryBuilder = $typo3DbQueryParser->convertQueryToDoctrineQueryBuilder($query);
        DebuggerUtility::var_dump($queryBuilder->getSQL());
        DebuggerUtility::var_dump($queryBuilder->getParameters());
    }
}
```

```php
protected function debugQueryBuilder(QueryBuilder $queryBuilder): void
{
    if ($this->debug) {
        DebuggerUtility::var_dump($queryBuilder->getSQL());
        DebuggerUtility::var_dump($queryBuilder->getParameters());
    }
}
```

## Fluid Templates {#fluid-templates}

The Fluid templates can be debugged by calling the `activateDebugMode()` function in the controller, which outputs the variables in a human-readable format. This can be useful for debugging the data passed to the templates and the logic within the templates.

```php
protected function activateDebugMode(): void
{
    $this->view->assign('debugActive', true);
}
```
