This XenForo 2.x addon adds logging functionality using the Monolog library from Seldaek/monolog
Features :
Usage Instructions
By default, this addon will log events to a file called
To use the default logging facility, do the following in your addon code :
However, it is recommended that you create your own channel for your addon to make it easier to filter log entries :
Refer to the documentation for more detailed usage instructions for Monolog.
You can create your own handler stack to customise how things are logged :
Refer to Handlers, Formatters and Processors for more information.
Télécharger V3.1.1 :
Version 4.0.0 implememts Monolog v2
Important to note is that the default date format in logs has changed for v2 - but for backwards compatibility I have reset the date format to that used by v1.
There is no new functionality in this version.
If you need Monolog v1 support - stay on the 3.x version of this addon - I will maintain that version for critical bugfixes.
Télécharger V4.0.0 :
Version 4.1.0 - XF 2.3 support :
- Added XF 2.3 support
Télécharger V4.1.0 :
Version 4.1.1 minor bugfix - assert admin permission on tools :
- Minor bugfix to explicitly enforce admin permissions on admincp tools.
Télécharger V4.1.1 :
Télécharger V5.0.3 :
Features :
- Log to a file
- Send logs via email
- Emailed logs are deduplicated and buffered
- Configure minimum logging levels for files vs email logging
- Add extra visitor data to logs: user_id and username
- Add extra web data to logs: current request URI, request method and client IP
- Test tool included to verify that logs are being written to disk - go to
AdminCP > Tools > Checks and tests > Test Monolog
Usage Instructions
By default, this addon will log events to a file called
internal_data/monolog.log - this is configurable.To use the default logging facility, do the following in your addon code :
PHP:
use Monolog\Helper\Log;
Log::info('an info message', ['context' => 'foo']);
Log::error('an error message', ['data' => 'bar']);
However, it is recommended that you create your own channel for your addon to make it easier to filter log entries :
PHP:
$logger = \XF::app()->get('monolog')->newChannel('myaddon');
$logger->warning('a warning message', ['context' => 'foo']);
Refer to the documentation for more detailed usage instructions for Monolog.
You can create your own handler stack to customise how things are logged :
PHP:
use Monolog\Logger;
$monolog = \XF::app()->get('monolog');
$streamhandler = $monolog->stream(); // return our default stream handler for logging to a file
//(or create your own!)
/** @var Monolog\Logger $logger */
$logger = $monolog->logger('myaddon');
$logger->pushHandler($streamhandler); // push our stream handler onto the handler stack
// you can apply any other customisations you like here as well by adding custom handlers, formatters or processors
$logger->critical('a critical message', ['context' => 'foo']);
Refer to Handlers, Formatters and Processors for more information.
Télécharger V3.1.1 :
Pour consulter le contenu, vous devez : Se connecter ou S'inscrire.
Version 4.0.0 implememts Monolog v2
Important to note is that the default date format in logs has changed for v2 - but for backwards compatibility I have reset the date format to that used by v1.
There is no new functionality in this version.
If you need Monolog v1 support - stay on the 3.x version of this addon - I will maintain that version for critical bugfixes.
Télécharger V4.0.0 :
Pour consulter le contenu, vous devez : Se connecter ou S'inscrire.
Version 4.1.0 - XF 2.3 support :
- Added XF 2.3 support
Télécharger V4.1.0 :
Pour consulter le contenu, vous devez : Se connecter ou S'inscrire.
Version 4.1.1 minor bugfix - assert admin permission on tools :
- Minor bugfix to explicitly enforce admin permissions on admincp tools.
Télécharger V4.1.1 :
Pour consulter le contenu, vous devez : Se connecter ou S'inscrire.
Version 4.1.2 (2025-12-12)
- run enqueuePostUpgradeCleanUp during upgrades if we're running XF2.3+
- latest composer dependencies
Pour consulter le contenu, vous devez : Se connecter ou S'inscrire.
5.0.0 (2026-10-02)
- new:
channel()returns aPSR-3 Psr\Log\LoggerInterfacefor an add-on's own log channel — type against that interface, not a Monolog class - deprecated:
newChannel(), now an alias forchannel(), and the staticHampel\Monolog\Helper\Log - removed:
logger(),default(),stream()andvisitor()— add or replace handlers and processors with the newhampel_monolog_setupcode event instead - new: post log records to Slack through an incoming webhook — one message per request, sent with a short timeout, and a failed post never reaches the add-on that was logging
- new: every option can be set in
$config['monolog']inconfig.php— file,emailandslacksections,request_id,visitor, web and site — and the options page shows it as set there; handlers, processors and a file formatter add to the stack with no add-on - new: a minimum level per channel in config.php, so one add-on can be traced at Debug without turning up every other
- new: Log File Format, Site Name and Add Request ID options; every record carries a request id, the web server's where it provides one
- new: monolog:config and monolog:validate CLI commands — what is configured, and whether it works, with --unattended for a deploy gate
- new: JSON records carry extra.site, extra.app and extra.schema
- new: README guidance on choosing log levels, and on supporting 4.x and 5.x from another add-on
- security: the log file option only accepts a path inside internal_data — a path outside it is ignored, and belongs in config.php
- fix: email alerts were switched on by a fresh install until the options were saved — such installs stop emailing until email is enabled
- fix: creating a log channel no longer builds XenForo's mailer, which could recurse with a mail add-on that logs
- email is sent through XenForo's own mail system, on 2.2 and 2.3 alike
- runs on Monolog 3 as well as 2
- requires XenForo 2.2 and PHP 7.4
5.0.1 (2026-10-04)
- fix: email and Slack treated two different errors with the same message as a repeat, and suppressed the second — a repeat now also has to match the channel and, where the record has one, the exception or a
fingerprintin its context - every message this add-on writes to the server error log now begins
Monolog:
5.0.2 (2026-10-08)
- new: monolog:validate --strict exits 2 when there are warnings and no failures — for a monitor; 1 still means a failure, and without the flag nothing changes
- monolog:validate warns when the log file, email and Slack are all off, where it used to report the empty logger as fine
- monolog:validate checks that email and Slack can record what they have sent, and warns if not — without that record every repeat is sent again
- every record monolog:validate and the Test Monolog page write carries probe: true in its context, so an alert over the log can leave them out
Version 5.0.3 (2026-10-09)
- documentation changes only; no change in behaviourTélécharger V5.0.3 :
Pour consulter le contenu, vous devez : Se connecter ou S'inscrire.

