How to write in the log every time an error is generated?

Asked

Viewed 45 times

1

Sirs,

1 - I would like to know what are the methods for analyzing and handling errors for websites with great traffic.

I am working with a site that is in wordpress, and I have come across some errors daily.

Examples are :

Erro de banco de dados do WordPress Lock wait timeout exceeded; try restarting transaction para a consulta INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`) VALUES ('_transient_doing_cron', '1497992508.0405650138854980468750', 'yes') ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`) feita por require('D:\home\site\wwwroot\wp-blog-header.php'), require_once('D:\home\site\wwwroot\wp-load.php'), require_once('D:\home\site\wwwroot\wp-config.php'), require_once('D:\home\site\wwwroot\wp-settings.php'), do_action('init'), WP_Hook->do_action, WP_Hook->apply_filters, call_user_func_array, wp_cron, spawn_cron, set_transient, add_option

PHP Fatal error:  Call to a member function have_posts() on null in D:\home\site\wwwroot\wp-content\themes\x\archive.php on line 75

I have no experience in error handling, so I would like to know how best to analyze and treat errors through logs.

2 - There is a more efficient way to find out which page generated the error ?

What I have done is go to the file and line that the log indicates, and analyze by desktop test what happens. However it is not all errors that indicate me a file. And these are the ones I can’t deal with, when I don’t know how to reproduce the error I end up not knowing where I should change to solve the problem.

I use php 5.6, tried to use FirePHP, it helped me a lot but only in cases where the log indicates file and line.

Is there a standard procedure ? Is there a way to get more information about an error ? How do I make so that when an error is generated in the log, besides the standard information, it contains tbm the information I want??

Example - User enters the www.dominio.com.br page and clicks on a button that redirects it to the www.dominio.com.br/test.php url that contains an error. I would like for any error to be written in the log : The default php + File path + Previous file path:

Erro de banco de dados do WordPress Lock wait timeout exceeded; try restarting transaction para a consulta INSERT INTO `wp_options` (`option_name`, `option_value`, `autoload`) VALUES ('_transient_doing_cron', '1497992508.0405650138854980468750', 'yes') ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`) feita por require('D:\home\site\wwwroot\wp-blog-header.php'), require_once('D:\home\site\wwwroot\wp-load.php'), require_once('D:\home\site\wwwroot\wp-config.php'), require_once('D:\home\site\wwwroot\wp-settings.php'), do_action('init'), WP_Hook->do_action, WP_Hook->apply_filters, call_user_func_array, wp_cron, spawn_cron, set_transient, add_option

Caminho do arquivo que gerou o erro: www.dominio.com.br/teste.php 
URL anterior ao erro : www.dominio.com.br/
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.