天天看點

vtiger debug 調試錯誤

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)

  1. To print all the SQL commands to the browser.

    In include/database/PearDatabase.php near line 680 replace:

    //$this->database->debug = true;
               
    with:
    $this->database->debug = true;
               
  2. To print DEBUG log data to the logfile logs/vtigercrm.log.

    In log4php.properties replace:

    log4php.rootLogger=FATAL,A1
               
    with:
    log4php.rootLogger=DEBUG,A1
               
  3. To print a value (or array) to the browser, insert the following in the PHP file:
    trigger_error('TempDebug: $someVariable="' 
                 .print_r($someVariable, TRUE) .'"');
               
    Don't forget to remove it afterward! :-)
  4. 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=
               
    "' 
                  .print_r($smallArray, TRUE) .'"
               
    '); Note however that trigger_error() truncates the output if the array is large. The following works on large arrays:
    trigger_error('TempDebug: $largeArray:...'); 
    print_r("
               
    ");
    print_r($largeArray);
    print_r("
               
    ");

Smarty Templates (*.tpl)

Smarty templates are used to programatically create HTML pages.

  1. 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:

    var $debugging       =  false;
               
    with:
    var $debugging       =  true;
               
  2. 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!

  1. To print a value (or array) to a brower message box, insert the following in the JavaScript file:
    alert('TempDebug: someVariable = "' +someVariable +'"');
               
  2. A JavaScript debugger is available for Firefox, Mozilla, Netscape [1].

轉載于:https://my.oschina.net/wangwang110/blog/11185