Skip to content

Working with log files

Nicholas K. Dionysopoulos edited this page May 27, 2023 · 1 revision

When debugging core or custom code you want to keep an eye on the log files. They help you understand what is going on.

Enabling full logging

Make sure that your config.php file contains the following two lines:

public $debug = '1';
public $log_level = 'debug';

The first line turns on debug mode which, among other things, displays an informative exception page (using Symfony ErrorHandler) and creates a debug.log file with very detailed debugging information.

The second line changes the default log level from warning (warnings and errors) to debug (debug, information, notices, warnings, and errors). This gives you a better picture of what is happening.

Reading the logs

All log files except the debug.log have the following format:

timestamp | level | message | context | extra

The debug.log has the following format:

timestamp | level | category | message | context | extra

The timestamp is the date and time of the log message in the format Year-Month-Date Hour:Minute:Second.Millisecon Timezone. The timezone of the log file is whatever your PHP installation is configured to use by default, see date.timezone in your php.ini file.

The level is one of the log message severity levels: debug, info, notice, warning, error, critical, alert, emergency. Panopticon uses the first six levels.

The category is the log file category. Remember, the debug.log file is a combination of all log sources, that's why it needs that. As far as the other log files are concerned, they're filename is the category.

The message is, of course, the message being written to the log.

The context and extra fields contain additional variables passed by the code to provide better context on the message. The extra field is not used by default, but can be used by custom (user) code.

Log categories

The following log categories exist in Panopticon:

  • extensionsupdate Updating Joomla! extensions. This is the main log file for all updates. Each site generates its own log file, e.g. extensionsupdate.2 for the site with an ID of 2.
  • extensionupdatesdirector. The task which schedules automatic Joomla! extension updates.
  • joomlaupdate. Updating Joomla! itself. This is the main log file for all updates. Each site generates its own log file, e.g. joomlaupdate.2 for the site with an ID of 2.
  • joomlaupdatedirector. The task which schedules automatic Joomla! updates.
  • maxexec. The benchmarking task which determines the maximum execution time for tasks. It normally only runs when setting up Panopticon.
  • refreshinstalledextensions. The task which refreshes the information about installed updates on Joomla! sites.
  • refreshsiteinfo. The task which refreshes the information about the Joomla! update status and the PHP version of a site.
  • sendmail. The task which sends enqueued email messages.

Using Ideolog

If you are using a JetBrains integrated development environment (IDE) such as PhpStorm, or Fleet, you can use the Ideolog plugin to more easily work with the log files.

You will need to go to your editor's Settings, Editor, Log Highlighting (Ideolog) and make the following changes.

Add the first log format:

  • Name: Panopticon with Category
  • Message pattern: ^(\d+-\d+-\d+\s+\d+:\d+:\d+(.\d+)\s\w+)\s*\|\s*(\w+)\s*\|\s*([^|]*)\s*\|\s*([^|]*)\s*\|\s*([^|]*)\s*\|(.*)$
  • Message start pattern: ^\d
  • Time format: yyyy-MM-dd HH:mm:ss,SSS
  • Time capture group: 1
  • Severity capture group: 2
  • Category capture group: 3
  • Apply message pattern to all message lines: not checked

Add the second log format:

  • Name: Panopticon without Category
  • Message pattern: ^(\d+-\d+-\d+\s+\d+:\d+:\d+(.\d+)\s\w+)\s*\|\s*(\w+)\s*\|\s*([^|]*)\s*\|\s*([^|]*)\s*\|(.*)$
  • Message start pattern: ^\d
  • Time format: yyyy-MM-dd HH:mm:ss,SSS
  • Time capture group: 1
  • Severity capture group: 2
  • Category capture group: 0
  • Apply message pattern to all message lines: not checked

Add (?i) in front of all patterns.

Now Ideolog can analyse Panopticon's log files.

Clone this wiki locally