4

This might be a too simple question for someone. How can I get a line break in my .log file by using Mage::log()? Whatever I pass to log() it treats as a string. Any help would be appreciated.

2 Answers 2

6

Just pass a Linux line break with double quotes

"\n"

Or if you are dumping an array, use a print method

print_r($array, true);
2
  • Thanks a lot. It worked perfectly. And +1 for the quick response.
    – Sukeshini
    Nov 5, 2014 at 9:39
  • I tried \n but it does not work.
    – Black
    Jun 17, 2018 at 13:54
4

Instead of "\n" you can just use

PHP_EOL

So you could type something like:

Mage::log(PHP_EOL.$your_message);

1
  • This should be the accepted answer!
    – Black
    Jun 17, 2018 at 13:55

Your Answer

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

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