PHP
Joomla! 6
Joomla! 5
Joomla! 3 (Legacy)
Helper / API
Basic
Write Structured Logs to administrator/logs/ with Log::addLogger()
Creates a dedicated _JEXEC-protected .php log file to audit webhooks, API sync jobs and background errors.
plugins/system/example/src/Extension/Example.php
<?php
declare(strict_types=1);
use Joomla\CMS\Log\Log;
Log::addLogger(
['text_file' => 'com_example.webhook.php'],
Log::ALL,
['com_example']
);
Log::add('Webhook processado com sucesso para pedido #482', Log::INFO, 'com_example');
Log::add('Falha na assinatura HMAC recebida', Log::ERROR, 'com_example');
Always end text_file with .php so web servers never serve raw log lines.
plugins/system/example/src/Extension/Example.php
<?php
JLog::addLogger(array('text_file' => 'com_example.webhook.php'), JLog::ALL, array('com_example'));
JLog::add('Evento registrado', JLog::INFO, 'com_example');
Legacy Joomla 3 version via JLog::addLogger() and JLog::add().
Technical explanation and best practices
Joomla\CMS\Log\Log writes log files prefixed with <?php die('Forbidden.'); ?> directly into Joomla configured $log_path so logs are never exposed over HTTP.