VOOZH about

URL: https://deepwiki.com/MahoCommerce/maho/5.5-logging-and-activity-tracking

⇱ Logging and Activity Tracking | MahoCommerce/maho | DeepWiki


Loading...
Last indexed: 15 May 2026 (ea8ab8)
Menu

Logging and Activity Tracking

This document covers Maho's logging and activity tracking systems, which include system-level file logging, encrypted administrator audit trails, and database-driven activity tracking.

Purpose and Scope

Maho provides multiple logging systems serving different purposes:

  • System Logging (Mage::log()): File-based application logging for errors, exceptions, and debugging using Monolog levels.
  • Admin Activity Logging (Maho_AdminActivityLog): Database-based encrypted audit trail tracking all administrator actions, including logins, configuration changes, and entity modifications.
  • Visitor Activity Logs (Mage_Log): Database tables tracking customer visits and URL accesses.
  • Cron Status Tracking: Monitoring of background job execution and history cleanup.
  • Security Captcha Tracking: Monitoring and verification of CAPTCHA challenges for both frontend and admin areas.

Sources: app/Mage.php23-30 app/code/core/Mage/Log/Model/Visitor.php50-55 app/code/core/Maho/Captcha/Model/Observer.php11-20

System Architecture Overview

High-Level Logging Flow


Diagram: Logging System Architecture - Shows the three logging systems: file-based system logging, encrypted admin activity tracking via observers, and visitor activity logging to database tables.

Sources: app/code/core/Mage/Log/Model/Visitor.php217-219 app/code/core/Mage/Core/Model/Config.php43


System Logging

System logging provides file-based application logging for errors, exceptions, and debugging using Monolog\Level.

System Logging Architecture


Sources: app/Mage.php23-30 app/Mage.php2296-2310

Log Levels

Maho utilizes Monolog\Level for its logging constants, ensuring compatibility with modern PHP logging standards.

ConstantLevelValue (Monolog)
Mage::LOG_EMERGENCYEmergencyLevel::Emergency
Mage::LOG_ALERTAlertLevel::Alert
Mage::LOG_CRITICALCriticalLevel::Critical
Mage::LOG_ERRORErrorLevel::Error
Mage::LOG_WARNINGWarningLevel::Warning
Mage::LOG_NOTICENoticeLevel::Notice
Mage::LOG_INFOInfoLevel::Info
Mage::LOG_DEBUGDebugLevel::Debug

Sources: app/Mage.php23-30


Admin Activity Logging

The Maho_AdminActivityLog module provides an encrypted audit trail of all administrator actions, ensuring that sensitive configuration changes or data modifications are tracked securely.

Data Flow and Encryption



Visitor Activity Tracking

The Mage_Log module tracks frontend visitor behavior.

Visitor Data Capture

The Mage_Log_Model_Visitor class initializes visitor data from server variables:


Cron and Background Tracking

Maho tracks the execution status of background tasks to ensure system health.

Cron Status Monitoring

The Mage_Cron_Model_Observer monitors the execution of the cron subsystem:

CLI Cron Management

The maho CLI provides commands to inspect and run cron jobs:

Sources: app/code/core/Mage/Cron/Model/Observer.php13-28 lib/MahoCLI/Commands/CronRun.php41-58 lib/MahoCLI/Commands/CronList.php31-46


Security Activity Tracking

The Maho_Captcha module tracks and verifies security challenges to prevent automated attacks.

Captcha Verification Flow

The system utilizes observers to intercept requests before dispatch:


Log Management and Cleanup

Database Log Cleanup

Maho provides mechanisms to prune historical data from tables like log_visitor and log_customer to prevent database bloat. This is handled via the cron system and CLI utilities.

FeatureConfiguration Path / CommandPurpose
Visitor Log Cleanupsystem/log/clean_after_dayPrunes visitor logs older than X days.
Cron Cleanupsystem/cron/history_cleanup_everyFrequency of cron schedule pruning.
CLI Statusmaho log:statusShows row counts and data sizes for all log tables lib/MahoCLI/Commands/LogStatus.php22-26
CLI Pruningmaho log:cleanManual trigger for database log pruning lib/MahoCLI/Commands/LogClean.php1-10

Monitored Tables in log:status

The following tables are tracked for size and row count:

Sources: app/code/core/Mage/Cron/Model/Observer.php21-26 lib/MahoCLI/Commands/LogStatus.php43-54 maho62-63