File based logging for auditing/debugging

Does Piwik write any information to log files? I see a [log] section in the global.ini.php file:

;possible values for log: screen, database, file
; normal messages
logger_message[]		= screen
logger_error[]			= screen
logger_exception[]		= screen

Theoretically, I could change “logger_message = file” to log to a file, but nothing seems to get logged (except when I turn on SQL logging). Help?

Also, how do I get some custom logging to show up in the log files? For instance, if I wanted to audit/debug what some of my custom plugins are doing, how would I go about doing this?

I guess this was a newbie question, but the answer really isn’t documented anywhere. So I looked through some of the Piwik code and figured it out. Here’s the solution in case other newbies need help with this.

The loggers are stored in the Zend Registry. To access them:

// All logs are written to dir "tmp/logs"
Zend_Registry::get('logger_message')->logEvent("My message");
Zend_Registry::get('logger_message')->logEvent($errno, $errstr, $errfile, $errline, $backtrace);

By default, logs are displayed on-screen rather than written to file. To re-direct logging to the files, you’ll have to add the following lines to your config.ini.php file:

logger_message[]    = file
logger_error[]        = file
logger_exception[]    = file

If you need an Audit Trail / Audit log, please check out our latest plugin: