Do You Want to Learn Marketing or Coding? Do You Want to Learn Marketing or Coding?

Magneto – Stop Magneto from write errors logs to /var/report

Share on facebook
Facebook
Share on twitter
Twitter
Share on linkedin
LinkedIn

Sometimes you don’t want magneto to write error reports to /var/reports/. For example, we have nightly back-ups which take multiple magento stores offline while the databases are being backed up on our database server. What is the problem with this? Well whenever someone hits the magneto site, over that 1-2 minute period at 3 o’clock in the morning, we get an error created. What does the error say? “Too many connections”. That makes sense because the database has to be locked whenever it is getting backed up. So this causes some problems. Why? Well if we have multiple magento stores getting taken offline, plus the server is doing a back-up, and if users hit site site what happens? Memory errors. How come, well whenever someone hits the site an apache process is generated to write the silly little file to the server. Plus it takes up disk-space. Boo…

So how do we change that?

First backup your index.php file. Find #Varien_Profiler::enable(); and make it:

Varien_Profiler::enable();

Next find Mage::setIsDeveloperMode(true); make the code around it:

//if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) {
Mage::setIsDeveloperMode(true);
//}

Finally find #ini_set(‘display_errors’, 1); make it:
ini_set('display_errors', 1);

That should send the site into development mode. Drawbacks, it doesn’t report to var/report, and it displays errors to the user, which could be a security issue.

Another possibility is to simply make var/report not writable. However this doesn’t stop magneto from spinning up the apache processes to write to var/report. But, it will still stop it from being written.

A final solution would be to find and back up the file errors/report.php. Then change $processor->saveReport($reportData); to this:

$processor->saveReport($reportData);

Always be sure to backup your code. Checkout my web site design portfolio. Or, ask me about my Visalia web site design services.

I Really Need

Reviewing nerdy stuff is expensive.

Consider clicking on this ad & buying that item you REALLY wanted from Amazon.

It helps a ton!

Leave Your Thoughts