Page tree
Skip to end of metadata
Go to start of metadata

Logging is accomplished through BMO using monolog and supports various add-ons and middle-ware written for monolog.


Starting at Framework Versions:

  • 13.0.195.26
  • 14.0.5.11
  • 15.0.1.34

Levels

LEVELLOGS LEVELS
DEBUGDEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY
INFOINFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY
NOTICENOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY
WARNINGWARNING, ERROR, CRITICAL, ALERT, EMERGENCY
ERRORERROR, CRITICAL, ALERT, EMERGENCY
CRITICALCRITICAL, ALERT, EMERGENCY
ALERTALERT, EMERGENCY
EMERGENCYEMERGENCY


Logging to the freepbx.log

php > FreePBX::Logger()->getDriver('default')->warning("warning message");
php > FreePBX::Logger()->getDriver('default')->info("info message");
php > FreePBX::Logger()->getDriver('default')->debug("debug message");

[2018-Dec-12 17:47:51] [default.WARNING]: warning message [] []
[2018-Dec-12 17:47:54] [default.INFO]: info message [] []
[2018-Dec-12 17:47:57] [default.DEBUG]: debug message [] []


In the above example FreePBX can be used with a created freepbx object replacing FreePBX::Logger() with something like $this->FreePBX→Logger.


Simple custom log

The following will log a warning message to (logpath)/mylog.log

php > FreePBX::Logger()->getDriver('mylog')->warning("warning message");

Custom path

$logger = FreePBX::Logger()->createLogDriver('mydriver', '/my/path/mylog.log', 'DEBUG');
$logger->warning('warning message');

The above will put a warning message to /my/path/mylog.log

  • No labels