joomlajoomla-extensions

Developer log in Joomla?


Does Joomla have a general purpose API for logging debug information to a file, or to the database, so that extension writers can capture debug info from a live site?

Enabling debug output and logging to screen is not an option. It's a live site.

Something like Drupal's watchdog would be nice.


Solution

  • I'm sorry for the short answer :)

    This page might help: https://docs.joomla.org/Using_JLog

    It shows how to configure the log output and how to use logging in your own code.


    EDIT, in case the link dies: Enable "Log Everything" under the properties of the System - Debug plugin. To create log records:

    JLog::add("Hello world", JLog::INFO);
    

    If within a namespace, qualify JLog:

    \JLog::add("Hello world", \JLog::INFO);
    

    There's no built-in log reading UI, just look at administrator/logs/everything.php.