Testing: Difference between revisions

Jump to navigation Jump to search
33 bytes added ,  24 June 2013
Line 115: Line 115:


=== check the server/service logs ===
=== check the server/service logs ===
==== Apache ====
==== OS ====
===== Microsoft Windows =====
** XP / Vista: 控制台 --> 系統管理工具 --> 事件檢視器
** [http://www.microsoft.com/technet/support/ee/ee_basic.aspx 事件和錯誤訊息中心: 基本搜尋]
 
==== Web server ====
===== Apache =====
[http://httpd.apache.org/ Apache HTTP server] log: /etc/httpd/logs  (location was set up in the configuration file /etc/httpd/conf/httpd.conf)
[http://httpd.apache.org/ Apache HTTP server] log: /etc/httpd/logs  (location was set up in the configuration file /etc/httpd/conf/httpd.conf)
* access.log
* access.log
Line 121: Line 127:
Using grep command to search the logs: {{kbd | key=<nowiki>grep -ir "string to search" /path/to/directory</nowiki>}}. More on [[Desktop_search#Search_text_in_files| Search text in files]]
Using grep command to search the logs: {{kbd | key=<nowiki>grep -ir "string to search" /path/to/directory</nowiki>}}. More on [[Desktop_search#Search_text_in_files| Search text in files]]


==== MySQL ====
===== IIS =====
[http://www.iis.net/ Microsoft Internet Information Services] (IIS) log (記錄檔)<ref>[http://www.dotblogs.com.tw/jimmyyu/archive/2009/06/26/9006.aspx (ASP.NET)從Log追蹤錯誤 - gipi的學習筆記-職場規劃、專案管理、雲端運算部落格- 點部落]</ref>
*  C:\WINDOWS\system32\LogFiles\
 
==== Database server ====
===== MySQL =====
[http://dev.mysql.com/doc/refman/5.1/en/server-logs.html MySQL Server Logs]:  
[http://dev.mysql.com/doc/refman/5.1/en/server-logs.html MySQL Server Logs]:  
* step1: enable logging /var/log/mysql.log (location was set up in the configuration file /etc/my.cnf or my.ini) <ref>[http://blog.longwin.com.tw/2005/10/mysql_query_slow_find/ 找出 MySQL 哪些 Query 速度較慢 | Tsung's Blog]</ref>
* step1: enable logging /var/log/mysql.log (location was set up in the configuration file /etc/my.cnf or my.ini) <ref>[http://blog.longwin.com.tw/2005/10/mysql_query_slow_find/ 找出 MySQL 哪些 Query 速度較慢 | Tsung's Blog]</ref>
Line 139: Line 150:
* step2: restart MySQL service
* step2: restart MySQL service


==== PHP ====
==== Other ====
===== native error logging =====
===== PHP =====
native error 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()] )
* [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
(for production site) unmark theese lines in the php.ini and restart Apache service
Line 152: Line 164:
</pre>
</pre>
* [http://php.net/manual/en/function.error-log.php PHP: error_log - Manual]
* [http://php.net/manual/en/function.error-log.php PHP: error_log - Manual]
===== capture the result of var_dump =====
 
capture the result of var_dump:
ob_start
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://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]
Line 168: Line 181:
</pre>
</pre>


===== show the line number and filename =====
show the line number and filename
<pre>
<pre>
echo 'Houston, we've had a problem '. __line__ . ' ' . __FILE__ ."<br />";
echo 'Houston, we've had a problem '. __line__ . ' ' . __FILE__ ."<br />";
Line 174: Line 187:
more on [http://php.net/manual/en/language.constants.predefined.php PHP: Magic constants]
more on [http://php.net/manual/en/language.constants.predefined.php PHP: Magic constants]


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


<pre>
<pre>
System.out.println("Boston, We Have A Problem" + variable);
System.out.println("Boston, We Have A Problem" + variable);
</pre>
</pre>
==== IIS ====
[http://www.iis.net/ Microsoft Internet Information Services] (IIS) log (記錄檔)<ref>[http://www.dotblogs.com.tw/jimmyyu/archive/2009/06/26/9006.aspx (ASP.NET)從Log追蹤錯誤 - gipi的學習筆記-職場規劃、專案管理、雲端運算部落格- 點部落]</ref>
*  C:\WINDOWS\system32\LogFiles\
==== Microsoft Windows ====
* Microsoft Windows
** XP / Vista: 控制台 --> 系統管理工具 --> 事件檢視器
** [http://www.microsoft.com/technet/support/ee/ee_basic.aspx 事件和錯誤訊息中心: 基本搜尋]


== find match string ==
== find match string ==

Navigation menu