Extbase - Debugging: Unterschied zwischen den Versionen
Aus Wikizone
(Die Seite wurde neu angelegt: „=== Extbase Debugging Tool === <syntaxhighlight lang="php"> print \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump( $this->settings['foo'] ); print \TYPO…“) |
|||
| Zeile 1: | Zeile 1: | ||
| + | == Debugging tools == | ||
| + | === Links === | ||
| + | https://typo3.org/api/typo3cms/class_t_y_p_o3_1_1_c_m_s_1_1_core_1_1_utility_1_1_debug_utility.html | ||
| + | |||
| + | https://typo3.org/api/typo3cms/class_t_y_p_o3_1_1_c_m_s_1_1_extbase_1_1_utility_1_1_debugger_utility.html | ||
| + | |||
| + | Es gibt mehrere, eines im Core eines unter Extbase, das führt leicht zu Verwirrung. Außerdem noch das alte unter t2lib::div (obsolete) Will man sie nutzen geht das z.B. so | ||
| + | use \TYPO3\CMS\Extbase\Utility\DebuggerUtility; | ||
| + | use \TYPO3\CMS\Core\Utility\DebugUtility; | ||
| + | ... | ||
| + | DebugUtility::debug($this->arrLines,"lines"); | ||
| + | |||
=== Extbase Debugging Tool === | === Extbase Debugging Tool === | ||
<syntaxhighlight lang="php"> | <syntaxhighlight lang="php"> | ||
Version vom 1. Juni 2016, 15:21 Uhr
Debugging tools
Links
https://typo3.org/api/typo3cms/class_t_y_p_o3_1_1_c_m_s_1_1_core_1_1_utility_1_1_debug_utility.html
Es gibt mehrere, eines im Core eines unter Extbase, das führt leicht zu Verwirrung. Außerdem noch das alte unter t2lib::div (obsolete) Will man sie nutzen geht das z.B. so use \TYPO3\CMS\Extbase\Utility\DebuggerUtility; use \TYPO3\CMS\Core\Utility\DebugUtility;
... DebugUtility::debug($this->arrLines,"lines");
Extbase Debugging Tool
print \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump( $this->settings['foo'] );
print \TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump( $this->settings['bla']['bar'] );
t3lib_utility_Debug::debug($var, 'Debug: ' . __FILE__ . ' in Line: ' . __LINE__);
# mit namespaces
\TYPO3\CMS\Core\Utility\DebugUtility::debug($var, 'Debug: ' . __FILE__ . ' in Line: ' . __LINE__);
Der var_dump kommt auch mit großen Objekten klar und kann auch Arrays anzeigen (gibt es aber erst in 4.6 oder 4.7):
Tx_Extbase_Utility_Debugger::var_dump($var);
# mit namespaces
\TYPO3\CMS\Extbase\Utility\DebuggerUtility::var_dump($var);
# Anzahl der Objekte ausgeben
t3lib_utility_Debug::debug(count($objects))
Debugging über eigenes Debug File
An manchen Stellen funktioniert debug nicht. Man kann aber in eine Datei schreiben. Evtl. vorher injecten.
//Write content to a file
$textFileCnt = 'Label: '.' SignalName:'.$signalName.chr(10);
$file1 = \TYPO3\CMS\Core\Utility\GeneralUtility::getFileAbsFileName('fileadmin/debug/debug.txt');
\TYPO3\CMS\Core\Utility\GeneralUtility::writeFile($file1, $textFileCnt);
Debugging über DevLog
Diese Extension kann ebenfalls ein Debug File schreiben. Das Logging muß zusätzlich im Install Tool aktiviert sein.