Search the Community
Showing results for tags 'log errors'.
-
Whenever there's a PHP or MySQL error on my production site, I want the error to be logged in a file. I have found a file called error_log in my site's root folder containing previous PHP and MySQL errors, so error logging is already working. But I want to understand how and why it's working. I checked my php.ini file: error_reporting = E_ALL & ~E_NOTICE display_errors = On display_startup_errors = Off ; Log errors into a log file (server-specific log, stderr, or error_log (below)) ; As stated above, you're strongly advised to use error logging in place of ; error displaying on production web sites. log_errors = On; ; Set maximum length of log_errors. In error_log information about the source is ; added. The default is 1024 and 0 allows to not apply any maximum length at all. log_errors = On; ; Log errors to specified file. error_log = error_log; ; Log errors to syslog (Event Log on NT, not valid in Windows 95). error_log = error_log; Question 1 How can there be two each of log_errors = On and error_log = error_log? Question 2 Will errors be logged in the error_log file no matter what, or do I have to use die()/trigger_error() in my code? In other words, if my database is down, will all of these lines log errors? mysql_query("SELECT * FROM `table` WHERE date IS NULL"); mysql_query("SELECT * FROM `table` WHERE date IS NULL") or die(mysql_error()); mysql_query("SELECT * FROM `table` WHERE date IS NULL") or trigger_error(mysql_error()); Question 3 If I put E_USER_ERROR in trigger_error(), will only that type of errors be logged?
- 16 replies
-
- error log
- log errors
-
(and 2 more)
Tagged with: