I would like to know how to log messages in custom module install script.

File path:


The script is running fine. I'm able to debug the file and see the SQL error, moreover, core_resource table is updated properly but the message under the catch block is not logged at:


My script:


try {
    $installer = $this;
       CREATE TABL 'dummy_table' (
        'id' int(11) unsigned NOT NULL auto_increment,
         PRIMARY KEY ('id')
} catch(Exception $e) {
    Mage::log('Something went wrong.', null, 'modulename_setup.log');


Any suggestions?

1 Answer 1


Yes I faced the problem before, the only way I managed to get it working was by forcing the log by setting the 4th parameter of Mage::log to true so in your case I suggest you use the following code

Mage::log('Something went wrong.', null, 'modulename_setup.log', true);
  • @brunof feel free to mark your question as answered so it will benefit for others May 23, 2016 at 18:30
  • I've tried but I'm not able because my reputation is under 15 points. =(
    – brunof
    May 23, 2016 at 19:15
  • @brunof you don't need to upvote to mark your question as answered you should be able to click the tick mark next to my answer can't you? May 23, 2016 at 19:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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