Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-50592

Add PSR3 support to mtrace/debugging/etc.

    XMLWordPrintable

    Details

    • Affected Branches:
      MOODLE_29_STABLE, MOODLE_32_STABLE

      Description

      The PHP Framework Interop Group has accepted a standard for the use of a Logger Interface within PHP, the details of which can be read at http://www.php-fig.org/psr/psr-3/.

      This standard has been implemented in the Monolog PHP library (https://github.com/Seldaek/monolog).

      The monolog library is already used by many libraries, frameworks, and applications globally including Symfony, Composer, Drupal, and countless others. Monolog is also authored and maintained by the author of the PSR3 specification; provides a stable base; and is implemented by many third-party log handlers.

      We really should look at doing adding support for PSR3 to Moodle.
      This can be done by:

      1. adding a default configuration for Monolog which uses a console handler to display messages
      2. replacing the content of mtrace() and debugging() calls with core_logger::info($message); or similar
      3. deprecating mtrace() and debugging() in the longer term
      4. allowing override of the default monolog configuration by passing a valid configuration object or class extending the moodle core_logger class.
      5. Add appropriate logging of all uncaught exceptions and fatal errors
      6. add logging of all performance metrics without having to parse files (you can send arrays to log handlers rather than having to parse a flat text string as we do now).

      This will aid:

      1. developers in capturing and preserving useful output as you can log individual messages to multiple locations;
      2. developers and administrators as all exceptions can be caught and logged - allowing for pro-active fixing of issues as they occur (you can also log the complete stacktrace)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              dobedobedoh Andrew Nicols
              Participants:
              Component watchers:
              Andrew Nicols, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              21 Vote for this issue
              Watchers:
              23 Start watching this issue

                Dates

                Created:
                Updated:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 5 minutes
                  5m