2

I made a small extension for Joomla 2.5 and it worked. But the issue is when i trying to make it compatible with Joomla 3, I get errors about JLog::getInstance method is not found. I know that they removed it and it got replaced by JLogLogger but that is also not working.

Can someone please help me and make it work? The code I am using in Joomla 2.5 is

$log = JLog::getInstance();
$log->addEntry(array('comment' => $server['REMOTE_ADDR'] . " is allowed"));

I made a variable called $log because I am using it more. This is just a small code from the extension.

PeeHaa
  • 71,436
  • 58
  • 190
  • 262
BiGGiE0344
  • 141
  • 9

1 Answers1

3

This code is from a similar question:

jimport('joomla.log.log');

JLog::addLogger(
    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 the code above doesn't work, try adding jimport('joomla.log.log'); to the top of the file on it's own instead.

Hope this helps

Community
  • 1
  • 1
Lodder
  • 19,758
  • 10
  • 59
  • 100