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

  • Resolved Preliot

    (@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

    (@tsteur)

    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

    (@tsteur)

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

    Thread Starter Preliot

    (@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:

    Trackingcode.php

    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.
    jicks83

    (@jicks83)

    .

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

    (@tsteur)

    Thanks for this @preliot

    I have prepared a fix for this in https://github.com/matomo-org/wp-matomo/pull/355 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 https://github.com/matomo-org/wp-matomo/pull/355

    It will be included in the next release.

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

    Thread Starter Preliot

    (@preliot)

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

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

    Plugin Author Thomas

    (@tsteur)

    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: https://matomo.org/faq/wordpress/i-have-a-problem-how-do-i-troubleshoot-and-enable-wp_debug/

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