Testing: Difference between revisions

Jump to navigation Jump to search
1,619 bytes removed ,  20 November 2015
Line 196: Line 196:
=== Other ===
=== Other ===
==== PHP ====
==== PHP ====
native error logging
[[PHP_errors#logging]]
* [http://www.php.net/ PHP] log: check the configuration file: /etc/php.ini (the location of configuration file can be verified by [http://php.net/manual/en/function.phpinfo.php phpinfo()] )
(for production site) unmark theese lines in the php.ini and restart Apache service
<pre>
log_errors = On
error_log = "php_error.log"
</pre>
(for development site) using [http://php.net/manual/en/function.error-reporting.php error_reporting]
<pre>
error_reporting(E_ALL);
</pre>
 
[http://tw1.php.net/print_r PHP: print_r - Manual]
<pre>
$log = print_r($variable, true);
//save to the log file
 
$log = print_r(debug_backtrace(), true);
//Generates a backtrace and save to the log file
</pre>
 
capture the result of var_dump:
ob_start
* [http://stackoverflow.com/questions/139474/how-can-i-capture-the-result-of-var-dump-to-a-string php - How can I capture the result of var_dump to a string? - Stack Overflow]
* [http://php.net/manual/en/function.error-log.php PHP: error_log - Manual]
<pre>
ob_start();
var_dump($some_variable);
$result = ob_get_clean();
error_log($result, 3, 'd:/result.log');
</pre>
 
QuickForm
<pre>
$result = var_dump($some_variable);
$form->addElement('html', $result);
</pre>
 
 
[http://ellislab.com/codeigniter CodeIgniter]: [http://stackoverflow.com/questions/7370391/how-to-configure-codeigniter-to-report-all-errors php - How to configure Codeigniter to report all errors? - Stack Overflow]
 
 
show the line number and filename
<pre>
echo 'Houston, we've had a problem '. __line__ . ' ' . __FILE__ ."<br />";
</pre>
more on [http://php.net/manual/en/language.constants.predefined.php PHP: Magic constants]


==== Java ====
==== Java ====

Navigation menu