View logs for the WP Discourse plugin

The WP Discourse plugin has its own logging system (since v2.2.5). This is an overview of how it works and how to use it. If you have any questions please respond below.

What is logged

All of the main WP Discourse feature-sets log errors (since v2.3.5). To log every action, including successful ones, you can turn on verbose logging for the relevant feature-set you want more information on. Look for a setting starting with “Verbose…” in the relevant settings tab.

How logs are stored

The plugin stores up to 10 days of logs in its own uploads/wp-discourse folder as .log files, with one file per day. That means it’ll only ever have 10 files at once, with a size limit of 5.25MB per file. Once that limit is reached, the oldest file will be removed as a new one is created (i.e. the logs are rotated).

If it’s not possible to store log files on your Wordpress instance, for example your uploads folder has restrictive permissions, then WP Discourse Logging won’t work for you just yet (all logs will be discarded).

Our logger is an extension of the widely used Monolog, which has a large number of Handlers, Formatters and Processors. We’ll add the ability for sites to use a different handler (from Monolog, or their own) once we’re happy with how our initial local .log handler performs.

How to view logs

You can view your logs in a new WP Discourse Admin tab called “Logs”. This lets you easily see what’s in each log file.

How to share logs

In the Log viewer you can download a zip file containing your logs, and a “meta" file about your Wordpress instance (software versions and WP Discourse setting values). This makes it easy for you to look at your logs locally, or potentially share them with someone helping to diagnose an issue.

:warning: Please note the “Privacy” section below before sharing your logs with a third party.

Privacy

The logs do not include any:

  • personally identifying information, e.g. names, emails and addresses; or
  • secrets, e.g. your Discourse API token.

These are minimum requirements to make it possible to share your logs with a third party who is helping you to diagnose an issue. You should still consider the privacy of your site’s and your users’ data, and your obligations concerning that data, before sharing your logs with anyone.

9 Likes