I'm playing with the new Joomla 1.7 system built on the Joomla platform 11-- and all my logging code from earlier versions of Joomla no longer work (they appear to be writing log entries but with improper syntax, so the messages are blank).
Does anyone know the proper syntax for the new version of JLog? Here's my existing code--
$log = &JLog::getInstance('test.log.php');
$log->addEntry(array('COMMENT' => 'A test Logging message'));
This creates the log file, but the actual log entry looks like this:
#<?php die('Forbidden.'); ?>
#Date: 2011-08-08 16:59:42 UTC
#Software: Joomla Platform 11.1 Stable+Modified [ Ember ] 01-Jun-2011 06:00 GMT
#Fields: date time priority clientip category message
2011-08-08 16:59:42 INFO 127.0.0.1 -
I've searched the Joomla docs and the web and found no examples of how to use this class.
Thanks!
Yes, the logging changed a bit indeed in Joomla 1.7:
// Include the JLog class.
jimport('joomla.log.log');
// Add the logger.
JLog::addLogger(
// Pass an array of configuration options
array(
// Set the name of the log file
'text_file' => 'test.log.php',
// (optional) you can change the directory
'text_file_path' => 'somewhere/logs'
)
);
// start logging...
JLog::add('Starting to log');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With