By default Magento logs notices, warnings and errors into the system.log file. Is it possible to restrict the log level so that Magento doesn't log PHP notices?

Magento's Mage::log() method offers the option to set the log level by providing, e.g. Zend_Log::DEBUG as a parameter, and it'd be great to suppress logging of PHP notices.

ps. I do know that fixing the code producing the errors would be recommended, but the errors originate from third-party code and extensions, so that'd be impossible to manage.

2 Answers 2


I think you'd like to set the level to Zend_Log::WARN, according to Zend_Log:

const EMERG   = 0;  // Emergency: system is unusable
const ALERT   = 1;  // Alert: action must be taken immediately
const CRIT    = 2;  // Critical: critical conditions
const ERR     = 3;  // Error: error conditions
const WARN    = 4;  // Warning: warning conditions
const NOTICE  = 5;  // Notice: normal but significant condition
const INFO    = 6;  // Informational: informational messages
const DEBUG   = 7;  // Debug: debug messages

As I see you cannot and won't go through the 3rd party code and set this globally, you could try to adjust the PHP error reporting this way:

error_reporting(E_ALL ^ E_NOTICE);

I didn't test it but maybe it helps to get rid of the entries in the log.

  • 1
    Adding error_reporting(E_ALL ^ E_NOTICE); to the index.php file did work. Easier than expected, but since the PHP notices originated from Apache, that's the way to go without having to modify third-party code.
    – oschloebe
    Sep 2, 2013 at 15:39

For advanced logging capabilities, take a look at https://github.com/magento-hackathon/Logger


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.