Server rental store

Log Management

# Log Management

This article details the configuration of log management for our MediaWiki 1.40 installation. Effective log management is crucial for troubleshooting, security auditing, and performance monitoring. This guide will cover log locations, configuration options within `LocalSettings.php`, and considerations for log rotation. It is intended for system administrators and power users responsible for maintaining the wiki server.

Log File Locations

MediaWiki generates several log files that record different types of events. Knowing their locations is the first step in effective log management. These locations are configurable, but the defaults are as follows:

Log File Description Default Location
error.log Records PHP errors, exceptions, and critical system messages. `/mw-config/error.log`
debug.log Contains detailed debugging information (only enabled with `$wgDebug` set to true). `/mw-config/debug.log`
access.log Records all incoming HTTP requests (requires web server configuration - see below). Determined by Web Server Configuration (e.g., Apache or Nginx)
watchlist.log Records changes made to pages on users' watchlists. `/mw-config/watchlist.log`
archive.log Records archive operations performed on pages. `/mw-config/archive.log`

Note: `` represents the root directory of your MediaWiki installation. This is defined in your web server configuration.

Configuring Logging in LocalSettings.php

The behavior of MediaWiki logging is primarily controlled through settings in the `LocalSettings.php` file. Here's a breakdown of key configuration options:

Configuration Variable Description Possible Values
`$wgDebug` Enables detailed debugging output. Use with caution in production environments. `true` or `false`
`$wgShowExceptionDetails` Controls whether full error details are displayed to users (use only for development/testing). `true` or `false`
`$wgLogErrors` Enables/disables writing PHP errors to `error.log`. `true` or `false`
`$wgParserCacheType` Affects logging of parser cache misses. `CACHE_NONE`, `CACHE_DB`, `CACHE_MEMCACHED`, `CACHE_REDIS`
`$wgEnableMailerWarning` Enables/disables warnings related to email sending. `true` or `false`
`$wgEmergencyContact` Sets an email address for emergency contact information displayed on error pages. A valid email address string.

Example configuration snippet within `LocalSettings.php`:

```wiki $wgDebug = false; $wgLogErrors = true; $wgShowExceptionDetails = false; $wgEmergencyContact = 'admin@example.com'; ```

Remember to clear the MediaWiki cache after making changes to `LocalSettings.php`. You can do this by deleting the cache directory or by accessing `https://yourwiki/w/index.php?action=purge&title=Special:AllPages` and letting the system rebuild the cache. See Manual:Configuration settings for more details.

Web Server Logging and Access.log

MediaWiki itself does *not* directly handle access logging (recording every HTTP request). This responsibility falls to your web server (Apache, Nginx, etc.). You *must* configure your web server to generate access logs.

⚠️ *Note: All benchmark scores are approximate and may vary based on configuration. Server availability subject to stock.* ⚠️