Is there a way to access the user logs in Magento? I know the database has a table called log_visitor that can see logs visitors, and log_visitor_info logs more info about the visitors (IP, user agent). How do I get to that data? When I write
$visitors = Mage::getModel('log/visitor')->getCollection()
foreach ($visitors as $visitor) {
print_r($visitor->getData());
}
I get an error PHP Fatal error: Uncaught exception 'Exception' with message 'Recoverable Error: Method Varien_Db_Select::__toString() must return a string value in /path/to/server/lib/Varien/Db/Adapter/Pdo/Mysql.php on line 272' in /path/to/server/app/code/core/Mage/Core/functions.php:239
You can use the direct database query if you’re not sure about object’s API.
For example