Support » Plugin: Matomo Analytics - Ethical Stats. Powerful Insights. » Only log messages with certain log level

  • Resolved Preliot


    This plugin clutters my debug.log with messages like:

    [29-Sep-2020 12:33:31 UTC] Matomo: Add tracking code. Blog ID: 1
    [29-Sep-2020 12:33:31 UTC] Matomo: Add noscript code. Blog ID: 1
    [29-Sep-2020 12:34:20 UTC] Matomo: Do not add tracking code to site (user should not be tracked) Blog ID: 1

    Matomo has the ability to only log certain log levels (like everything above WARN level). Would be nice if this is also implemted in this plugin.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Thomas


    Hi @preliot

    thanks for bringing this up and happy to look into this. We have partially different log levels but not fully everywhere yet. Are there maybe some entries that cause the most clutter?

    Plugin Author Thomas


    Note that Matomo will only log it currently if WP_DEBUG is enabled.

    Thread Starter Preliot


    For my project(s) i always enable WP_DEBUG & WP_DEBUG_LOG to catch all possible errors before users complain about them. The most simplest solution i see is to create a seperate constant for logging, something like MATOMO_DEBUG.

    Or if you prefer to be on the safe side, first check the existince and value of MATOMO_DEBUG and then fallback to WP_DEBUG. πŸ™‚

    To answer your questions: I’ve checked the codebase and see about 83 calls to $this->logger->log. The ones that pop up often in my debug.log are the once mentioned.
    They originate at:


    method add_javascript_code()

    line 93
    line 100

    method add_noscript_code()

    line 131

    Thank you for your work on this excellent plugin!

    • This reply was modified 1 year ago by Preliot.



    • This reply was modified 1 year ago by jicks83.
    Plugin Author Thomas


    Thanks for this @preliot

    I have prepared a fix for this in where by default we now log less. Additionally we now support the ability to disable all logging and to force the logging of all messages. It’s documented in above link as well as in

    It will be included in the next release.

    Thanks for mentioning it I could see how much it was actually logging πŸ™‚

    Thread Starter Preliot


    @tsteur I’m impressed by the speed! Thanks!

    No longer “miles” of debug.log, i’m looking forward to it πŸ™‚

    Plugin Author Thomas


    Hope it helps πŸ™‚ Let us know in case there’s still an issue afterwards.

    BTW here’s the link to the FAQ where it’s documented also in case someone is looking for it:

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Only log messages with certain log level’ is closed to new replies.