If you are webmaster of a magento shop then you always want to be a first people who see any problem of magento shop. This instruction I will tell you how to get error reports via email, every time magento have new report, it will send to you an email about error detail.
One of the ways how to get Magento error reports to your email during development time.
Lets install inotify tools
Code:
yum install inotify-tools
In this example magento is installed here /var/www/html/
inotifywait will monitor (-m) /var/www/html/var/report
Code:
#!/bin/bash
inotifywait -m /var/www/html/var/report 2>&- | awk '$2 == "CREATE" { print $3; fflush() }' |
while read file; do
mail -s "MAGENTO ERROR REPORT FILE" [email protected] < $file
done
Every new report created will be sent to your mailbox right away!
Code:
a:5:{i:0;s:105:"SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)";i:1;s:1413:"
#0 /var/www/html/lib/Zend/Db/Adapter/Pdo/Mysql.php(96): Zend_Db_Adapter_Pdo_Abstract->_connect()
#1 /var/www/html/lib/Varien/Db/Adapter/Pdo/Mysql.php(313): Zend_Db_Adapter_Pdo_Mysql->_connect()
#2 /var/www/html/lib/Zend/Db/Adapter/Abstract.php(459): Varien_Db_Adapter_Pdo_Mysql->_connect()
#3 /var/www/html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SET NAMES utf8', Array)
#4 /var/www/html/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('SET NAMES utf8', Array)
#5 /var/www/html/app/code/core/Mage/Core/Model/Resource.php(169): Varien_Db_Adapter_Pdo_Mysql->query('SET NAMES utf8')
#6 /var/www/html/app/code/core/Mage/Core/Model/Resource.php(110): Mage_Core_Model_Resource->_newConnection('pdo_mysql', Object(Mage_Core_Model_Config_Element))
#7 /var/www/html/app/code/core/Mage/Core/Model/Resource/Setup.php(141): Mage_Core_Model_Resource->getConnection('core_setup')
#8 /var/www/html/app/code/core/Mage/Core/Model/Resource/Setup.php(234): Mage_Core_Model_Resource_Setup->__construct('core_setup')
#9 /var/www/html/app/code/core/Mage/Core/Model/App.php(417): Mage_Core_Model_Resource_Setup::applyAllUpdates()
#10 /var/www/html/app/code/core/Mage/Core/Model/App.php(343): Mage_Core_Model_App->_initModules()
#11 /var/www/html/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#12 /var/www/html/index.php(87): Mage::run('default', 'store')
#13 {main}";s:3:"url";s:1:"/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:7:"default";}
you can run this script in screen or using main config with init script as well.
View more threads in the same category:
Bookmarks