Logging

From MoodleDocs

When users interact with Moodle, many of their interactions are logged using the Events subsystem. This subsystem includes a powerful, and granular, logging mechanism which allows the collection of relevant information.

The Moodle core logs common interactions, and most activities also include granular logging of student progress through the activity.

Examples of log entries include:

  • logging in or out
  • accessing a course
  • updating a course
  • viewing an activity within a course
  • viewing a forum discussion
  • creating a new forum discussion
  • replying to an existing post in a forum discussion
  • completing an activity

Log stores

When an event is logged, it can be sent to zero, or more log stores. A log store is simply a data warehouse for the log entries.

Moodle comes includes with three log stores:

  • Standard
  • External database
  • Legacy - typically only used if you have used an older version of Moodle. You should not normally need to enable this log store.

Your site administrator can choose which log stores are enabled, and in which order, from Administration > Site administration > Plugins > Logging > Manage log stores.

Note: A new Moodle site will have Standard logging enabled and Legacy logging disabled. A site which has been upgraded will have both enabled.

The default Standard log is very detailed and should meet most requirements.

The "Write buffer size" is the number of log entries inserted in one batch database operation, which improves performance.

logstores.png

From Site administration > Plugins > Reports > Manage reports, the administrator can see which log stores support which given report:

reportslogstore.png

External log store

An External database log store also allows you to connect to an external log database. This uses the same logging format as the Standard log store, but allows you to send logs to a different database. It can still be queried from within the Moodle User Interface, and is sometimes preferable on busy sites where many logs are created.

Legacy log store

The Legacy log should be disabled unless you have old custom reports that need it.

Note that if you disable Legacy logs, you won't be able to look/show/display (existing) Legacy logs, and no new Legacy logs will be generated. This could be a problem for non -standard plugins which still generate Legacy logs instead of Standard logs. In time it is to be hoped all contributed plugins will use Standard logs. You can disable the legacy store plugin completely OR you can oNoy disable writing to legacy log inside the plugin settings. In the second case, you will be able to read from the log but no new entries will be added. This is also what will be set automatically during upgrade.

This plugin will be removed in Moodle 4.1.

Analytics

Moodle also has a powerful Analytics engine, which uses Machine Learning to predict and warn of potential student outcomes. Many of these predictions are based upon the logs that are generated and stored by Moodle.

Please note that some Log Store plugins are write-only and cannot be used for this purpose. Both the Standard logstore, and the External logstore included with Moodle are compatible with the Moodle Analytics features.

See also