There are a few possibilities with regards to debug logging in Matomo (Piwik).
- Enable logging in the Tracker can be useful to debug Tracking issues or improvements. See the documentation page about enabling Debug logging in the piwik.php tracker
Enable logging in the Matomo (Piwik) UI: by default, Matomo logs messages in the UI (using notification boxes). If you want additional logging details, or if you want to enable logging to a file you can edit your config.ini.php and set the following options:
[log] ; Possible values are "screen" (default value), "file" and "database" (logs to tables logger_*) log_writers = file ; Possible values are ERROR, WARN, INFO, DEBUG log_level = WARN ; if configured to log to file, log entries will be written to this file logger_file_path = tmp/logs/matomo.log
All logging configuration options can be found in config/global.ini.php
MonologPlugin must be activated in your Matomo (Piwik) server, you can check it by going to Administration > Plugins.
- Once you have enabled logging, you can easily view & search the logs by using our LogViewer plugin: learn more in How do I view Matomo (Piwik) application logs?
You may also enable SQL logging & profiling to see the list of SQL queries executed by Matomo (Piwik) on any given page or widget. First, enable logging on screen (see point above). Then, edit your config.ini.php and add the following:
[Debug] enable_sql_profiler = 1
Matomo (Piwik) will then output all SQL queries, group them by unique query, and show the total time spent as well as average time spent on each query.