I am using magento I had continously trouble with modules which throw notice warnings which in turn broke some functionality. So I've managed to ignore Notice Warnings by putting error_reporting(E_ALL ^ E_NOTICE); in index.php, get.php and api.php.

Before that I managed to handle these errors with my own handler in index.php

set_error_handler('noticeErrorHandler', E_NOTICE | E_STRICT) ;

function noticeErrorHandler($code, $err_msg, $err_file, $err_line, array $err_context) {
  $error = $log = null;
  switch ($code) {
    case E_NOTICE:
    case E_USER_NOTICE:
      $error = 'Notice';
    case E_STRICT:
      $error = 'Strict';

  Mage::Log($error . ": " . $err_msg . " in " . $err_file . " on line " . $err_line, null, "notices.log");

But Mage::Log is not working before Mage::run and it is not really a nice solution to put this in index.php.

My question is: is there a nice solution to prevent Magento from raising errors for notice warnings and put them in an own notices.log file for every site request, like api requests too?


  • 1
    Try to add true as 4th parameter of Mage::log() method – Jayesh Patel Mar 23 '16 at 12:17

By default, Magento does not log messages about errors and exceptions;

So if something bad happens, you don't even know.

To turn on the logging, you can navigate to

System > Configuration > Developer > Log Settings

and set the «Enabled» option to «Yes»

Also var and var/log folder permission need to be 0777

| improve this answer | |

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.