2

I have exhausted every trick in my book. Magento will not log anything at all, to debug I inserted two log calls in index.php

if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
    Mage::setIsDeveloperMode(true);
    Mage::log("WOOOOPIE");
    error_log("Go sell your fur");
}
  • php error_log works and logs to /var/log/apache2/error.log
  • {{Magento dir}}/var/log/system.log and exception.log are empty.
  • In the Admin panel, Under Configuration > Developer, I enabled profiler and error logging.
  • The entire var directory is owned by www-data and chmod'ed 777, I checked ps aux and envvars to confirm apache is running as www-data.
  • All caches were cleared repeatedly, then disabled.
  • index.php has the default of error_reporting(E_ALL | E_STRICT); set.

Here are the permissions of system.log, I had to touch it myself.

namei -ml /var/www/nslocal/var/log/system.log`
f: /var/www/nslocal/var/log/system.log
drwxr-xr-x root     root     /
drwxr-xr-x root     root     var
drwxrwxr-x root     www-data www
drwxrwxr-x www-data ci       nslocal
drwxrwxrwx www-data ci       var
drwxrwxrwx www-data ci       log
-rwxrwxrwx www-data ci       system.log

I have even tried restarting. Without the log working I can't debug why magento isn't sending emails, despite php and sendmail working properly. Do I have a ghost?

  • Sounds like you've tried the usual suspects that I'm aware of (although chmod 777 is using a sledge hammer). Do you have interactive debugging working? It might be useful to step through the code and see at which point it breaks? – Luke Rodgers Dec 30 '14 at 14:54
  • 1
    I found mine in /tmp/magento/var/log/system.log – arsenik Nov 30 '16 at 18:51
5

From what I understand, the Mage logger will not function so early in the application spin up.

If you look at the Mage::log function itself, you'll find:

if (!self::getConfig()) { return; }

As Mage::getConfig() will return null until the application's config is initialised later on inside the Mage::run() function, the Mage::log function will exit without doing anything when called from index.php.

To test the logging is actually working, try placing your test later on, perhaps in Mage_Core_Controller_Varien_Front::dispatch which works for me.

  • 1
    Thank you very much! I can't believe that all my modules and Magento are so quiet that I didn't get a single error or exception throughout the entire painful metadebugging process. – Ray Foss Dec 30 '14 at 15:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.