vtiger 5.2.0 的調試
資料庫調試,在需要的頁面,加入以下代碼即可
global $adb;
$adb->setDebug(true);
打開log日志調試
1.先找到config.performance.php 把 'LOG4PHP_DEBUG' => false改為 'LOG4PHP_DEBUG' => true
2.找到log4php.properties,把log4php.rootLogger=FATAL,A1 改為log4php.rootLogger=INFO,A1
以前版本的調試看這裡
PHP Files (*.php)
-
To print all the SQL commands to the browser.
In include/database/PearDatabase.php near line 680 replace:
with://$this->database->debug = true;
$this->database->debug = true;
-
To print DEBUG log data to the logfile logs/vtigercrm.log.
In log4php.properties replace:
with:log4php.rootLogger=FATAL,A1
log4php.rootLogger=DEBUG,A1
- To print a value (or array) to the browser, insert the following in the PHP file:
Don't forget to remove it afterward! :-)trigger_error('TempDebug: $someVariable="' .print_r($someVariable, TRUE) .'"');
- Better still, to print an array to the browser in a more legible format we add opening and closing HTML
tags:
trigger_error('TempDebug: $smallArray=
'); Note however that trigger_error() truncates the output if the array is large. The following works on large arrays:"' .print_r($smallArray, TRUE) .'"
trigger_error('TempDebug: $largeArray:...'); print_r("
");"); print_r($largeArray); print_r("
Smarty Templates (*.tpl)
Smarty templates are used to programatically create HTML pages.
-
To list all the data available to a Smarty template in a separate browser window:
In /Smarty/libs/Smarty.class.php near line 104 replace:
with:var $debugging = false;
var $debugging = true;
- In a Smarty template data can be "printed" into an HTML comment and then viewed by selecting View->Page Source in your browser. This example shows some of the parameters "passed" from PHP code to a Smarty template:
AJAX and JavaScript (*.js)
Warning: Changes in AJAX code may require matching changes in Smarty code!
- To print a value (or array) to a brower message box, insert the following in the JavaScript file:
alert('TempDebug: someVariable = "' +someVariable +'"');
- A JavaScript debugger is available for Firefox, Mozilla, Netscape [1].
轉載于:https://my.oschina.net/wangwang110/blog/11185