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 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", "database" (logs to tables logger_*),
    ; "errorlog" (logs using the error_log() php function) and "syslog" (logs to the syslog service)
    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
    ; if configured to log to syslog, this is used as the identifier
    logger_syslog_ident = matomo
    

All logging configuration options can be found in config/global.ini.php

Important notes:

  • The Monolog Plugin must be activated in your Matomo 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 application logs?
  • You may also enable SQL logging & profiling to see the list of SQL queries executed by Matomo 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 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.

Previous FAQ: Emails from Matomo are not being sent, how do I troubleshoot and solve the issue?