Question

I am working locally on an xampp setup. I am trying to debug a problem using Mage::log() but nothing is showing up in my system.log file.

Every page load just gives me two lines of output:

2014-03-20T02:46:58+00:00 DEBUG (7):
2014-03-20T02:47:03+00:00 DEBUG (7):

No matter where I put Mage::log() I still get these two lines.

Was it helpful?

Solution

First of all remove your Mage::log() statement and see if the system.log still gets populated with <config />. I have a feeling that it comes from somewhere else.

Here is how the logging works.
In Mage::log there is this code

if (!self::$_isDeveloperMode && !$logActive && !$forceLog) {
    return;
}

This means that if you don't have the developer mode on, and the logging is not active and you don't pass the 4th parameter to the log method that tells it to force the log, nothing will get logged.

What you can do. Any one of the following is enough.

  1. Enable the developer mode. You should always develop with developer mode on. Add this line to the httpd.conf: SetEnv MAGE_IS_DEVELOPER_MODE 1.
  2. Activate the log from System->Configuration->Developer->Log Settings.
  3. Force the logging to make sure it always works even if the log is not active or developer mode is off. Call the log method like this: Mage::log('Text to log', null, '', true). Notice the 4th parameter set to true.
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top