Core Documentation
Here you will find the new official reference manuals. These documents are related to the core of TYPO3 and address the built in functionality of TYPO3. They are designed to provide you with in-depth information.
- Coding Guidelines
- Core Api Reference
- File Abstraction Layer
- Inside TYPO3
- Skinning
- TCA-Reference
- TSconfig Reference
- Typoscript Reference
- Typoscript Syntax
- TYPO3 Services
Old Core Documentation
All configuration options related to error and exception handling are found in $TYPO3_CONF_VARS[SYS]:
Key | Datatype | Description |
|---|---|---|
displayErrors | integer | Configures whether PHP errors should be displayed.
|
errorHandler | string | Classname to handle PHP errors. Leave empty to disable error handling. Default: “t3lib_error_ErrorHandler”. This class will register itself as error handler. It is able to write error messages to all available logging systems in TYPO3 (t3lib_div::syslog, t3lib_div::devlog() and to the sys_log table). Additionally the errors can be displayed as flash messages in the Backend or in the adminpanel in Frontend. The flash messages in Backend are only displayed if the error and exception handling is in “debug-mode”, which is the case when the configured “debugExceptionHandler” is registered as exception handler (see: TYPO3_CONF_VARS[SYS][displayErrors]). Errors which are registered as “exceptionalErrors” will be turned into exceptions (to be handled by the configured exceptionHandler). |
errorHandlerErrors | integer | The E_* constant that will be handled by the error handler Default: E_ALL ^ E_NOTICE |
exceptionalErrors | integer | The E_* constant that will be handled as an exception by the error handler. Default: "E_ALL ^ E_NOTICE ^ E_WARNING ^ E_USER_ERROR ^ E_USER_NOTICE ^ E_USER_WARNING" (4341) and "0" if displayError=0. Refer to the PHP documentation for more details on this value. |
productionExceptionHandler | string | Classname to handle exceptions that might happen in the TYPO3-code. Leave empty to disable exception handling. Default: “t3lib_error_ProductionExceptionHandler”. This exception handler displays a nice error message when something went wrong. The error message is logged to the configured logs. Note: The configured productionExceptionHandler is used if displayErrors is set to “0” or to “-1” and devIPmask doesn't match. |
debugExceptionHandler | string | Classname to handle exceptions that might happen in the TYPO3-code. Leave empty to disable exception handling. Default: “t3lib_error_DebugExceptionHandler”. This exception handler displays the complete stack trace of any encountered exception. The error message and the stack trace is logged to the configured logs. Note: The configured debugExceptionHandler is used if displayErrors is set to “1” and if displayErrors is “-1” or “2” and the devIPmask matches. |
enable_errorDLOG | boolean | Whether errors should be written to the developer log (requires an installed *devlog extension). |
enable_exceptionDLOG | boolean | Whether exceptions should be written to the developer log (requires an installed *devlog extension). |
syslogErrorReporting | integer | Configures which PHP errors should be logged to the configured syslogs (see: [SYS][systemLog]). If set to "0" no PHP errors are logged to the syslog. Default is "E_ALL ^ E_NOTICE" (6135). |
belogErrorReporting | integer | Configures which PHP errors should be logged to the "syslog" table (extension: belog). If set to "0" no PHP errors are logged to the sys_log table. Default is "E_ALL ^ E_NOTICE" (6135). |
The table below shows which values can be set by the user and which are set by TYPO3.
Values in black can be changed in localconf.php.
Values in red are set by TYPO3.
display Errors | errorHandler Errors | exceptionalErrors | errorHandler | devIP mask | exception Handler | display_ errors (php_ini) |
|---|---|---|---|---|---|---|
-1 | E_ALL ^ E_NOTICE | E_ALL ^ E_NOTICE ^ E_WARNING ^ E_USER_ERROR ^ E_USER_NOTICE ^ E_USER_WARNING | t3lib_error_ErrorHandler | match | $TYPO3_CONF_VARS['SYS']['debugExceptionHandler'] | Not changed |
no match | $TYPO3_CONF_VARS['SYS']['productionExceptionHandler'] | |||||
0 | E_ALL ^ E_NOTICE | 0 (no errors are turned into exceptions) | t3lib_error_ErrorHandler | Doesn't matter | $TYPO3_CONF_VARS['SYS']['productionExceptionHandler'] | 0 (Off) |
1 | E_ALL ^ E_NOTICE | E_ALL ^ E_NOTICE ^ E_WARNING ^ E_USER_ERROR ^ E_USER_NOTICE ^ E_USER_WARNING | t3lib_error_ErrorHandler | Doesn't matter | $TYPO3_CONF_VARS['SYS']['debugExceptionHandler'] | 1 (On) |
2 | E_ALL ^ E_NOTICE | E_ALL ^ E_NOTICE ^ E_WARNING ^ E_USER_ERROR ^ E_USER_NOTICE ^ E_USER_WARNING | t3lib_error_ErrorHandler | match | $TYPO3_CONF_VARS['SYS']['debugExceptionHandler'] | 1 (On) |
no match | $TYPO3_CONF_VARS['SYS']['productionExceptionHandler'] | 0 (Off) |
The class t3lib_error_ErrorHandler is the default error handler in TYPO3.
Functions:
Can be registered for all, or for only a subset of the PHP errors which can be handled by an error handler
Displays error messages as flash messages in the Backend (if exceptionHandler is set to “t3lib_error_DebugExceptionHandler”). Since flash messages are integrated in the Backend template, PHP messages will not destroy the Backend layout.
Displays errors as TsLog messages in the adminpanel.
Logs error messages to t3lib_div::syslog() which is able to write error messages to a file, to the web server's error_log, the system's log and it can send you errors and exceptions in an email. t3lib_div::syslog() offers a hook and can be extended by user-defined logging methods.
Logs error messages to t3lib_div::devLog() if “enable_errorDLOG” is enabled (depending on the devlog extension used, this might require an existing DB connection).
Logs error messages to the sys_log table. Logged errors are displayed in the belog extension (Tools->Log) (works only if there is an existing DB connection).
Functions of t3lib_error_ProductionExceptionHandler
Shows brief exception message using t3lib_timeTrack::debug_typo3PrintError() which can be manipulated by a hook
Logs exception messages to t3lib_div::syslog() which is able to write exception messages to a file, to the web server's error_log, the system's log and it can send you errors and exceptions in an email. t3lib_div::syslog() offers a hook an can be extended by user-defined logging methods.
Logs exception messages to t3lib_div::devlog() if “enable_exceptionDLOG” is enabled (depending on the devlog extension used, this might require an existing DB connection).
Logs exception messages to the sys_log table. Logged errors are displayed in the belog extension (Tools->Log) (works only if there is an existing DB connection).
Functions of t3lib_error_DebugExceptionHandler
Shows detailed exception messages and full trace of an exception
Logs exception messages to t3lib_div::syslog() which is able to write exception messages to a file, to the web server's error_log, the system's log and it can send you errors and exceptions in an email. t3lib_div::syslog() offers a hook an can be extended by user-defined logging methods.
Logs exception messages to t3lib_div::devlog() if “enable_exceptionDLOG” is enabled (depending on the devlog extension used, this might require an existing DB connection).
Logs exception messages to the sys_log table. Logged errors are displayed in the belog extension (Tools->Log) (works only if there is an existing DB connection).
Very verbose configuration which logs and displays all errors and exceptions.
[File: localconf.php]
$TYPO3_CONF_VARS['SYS']['displayErrors'] = '1';
$TYPO3_CONF_VARS['SYS']['devIPmask'] = '*';
$TYPO3_CONF_VARS['SYS']['errorHandler'] = 't3lib_error_ErrorHandler';
$TYPO3_CONF_VARS['SYS']['errorHandlerErrors'] = E_ALL ^ E_NOTICE;
$TYPO3_CONF_VARS['SYS']['exceptionalErrors'] = E_ALL ^ E_NOTICE ^ E_WARNING ^ E_USER_ERROR ^ E_USER_NOTICE ^ E_USER_WARNING;
$TYPO3_CONF_VARS['SYS']['debugExceptionHandler'] = 't3lib_error_DebugExceptionHandler';$TYPO3_CONF_VARS['SYS']['productionExceptionHandler'] = 't3lib_error_DebugExceptionHandler';
$TYPO3_CONF_VARS['SYS']['systemLogLevel'] = '0';
$TYPO3_CONF_VARS['SYS']['systemLog'] = 'mail,test@localhost.local,4;error_log,,2;syslog,LOCAL0,,3;file,/abs/path/to/logfile.log';
$TYPO3_CONF_VARS['SYS']['enable_errorDLOG'] = '1';$TYPO3_CONF_VARS['SYS']['enable_exceptionDLOG'] = '1';
[File: .htaccess]
php_flag display_errors onphp_flag log_errors onphp_value error_log /path/to/php_error.log
Example for a production configuration which displays only errors and exceptions if the devIPmask matches. Errors and exceptions are only logged if their level is at least 2 (=Warning).
[File: localconf.php]
$TYPO3_CONF_VARS['SYS']['displayErrors'] = '2';
$TYPO3_CONF_VARS['SYS']['devIPmask'] = '[your.IP.address]';
$TYPO3_CONF_VARS['SYS']['errorHandler'] = 't3lib_error_ErrorHandler';
$TYPO3_CONF_VARS['SYS']['systemLogLevel'] = '2';$TYPO3_CONF_VARS['SYS']['systemLog'] = 'mail,test@localhost.local,4;error_log,,2;syslog,LOCAL0,,3';
$TYPO3_CONF_VARS['SYS']['enable_errorDLOG'] = '0';$TYPO3_CONF_VARS['SYS']['enable_exceptionDLOG'] = '0';$TYPO3_CONF_VARS['SYS']['syslogErrorReporting'] = E_ALL ^ E_NOTICE ^ E_WARNING;$TYPO3_CONF_VARS['SYS']['belogErrorReporting'] = '0';
[File: .htaccess]
php_flag display_errors offphp_flag log_errors onphp_value error_log /path/to/php_error.log
Since the error and exception handling and also the logging need some performance, here's an example how to disable error and exception handling completely.
[File: localconf.php]
$TYPO3_CONF_VARS['SYS']['displayErrors'] = '0';
$TYPO3_CONF_VARS['SYS']['devIPmask'] = '';
$TYPO3_CONF_VARS['SYS']['errorHandler'] = '';
$TYPO3_CONF_VARS['SYS']['debugExceptionHandler'] = '';$TYPO3_CONF_VARS['SYS']['productionExceptionHandler'] = '';
$TYPO3_CONF_VARS['SYS']['systemLog'] = '';
$TYPO3_CONF_VARS['SYS']['enable_errorDLOG'] = '0';$TYPO3_CONF_VARS['SYS']['enable_exceptionDLOG'] = '0';$TYPO3_CONF_VARS['SYS']['syslogErrorReporting'] = '0';$TYPO3_CONF_VARS['SYS']['belogErrorReporting'] = '0';
[File: .htaccess]
php_flag display_errors offphp_flag log_errors off
If you want to register your own error or exception handler, simply include the class and insert its name to “productionExceptionHandler”, “debugExceptionHandler” or “errorHandler”.
Example:
$TYPO3_CONF_VARS['SYS']['errorHandler'] = 'myOwnErrorHandler';
$TYPO3_CONF_VARS['SYS']['debugExceptionHandler'] = 'myOwnDebugExceptionHandler';$TYPO3_CONF_VARS['SYS']['productionExceptionHandler'] = 'myOwnProductionExceptionHandler';
An error or exception handler class must register an error (exception) handler in its constructor. Have a look at the files in t3lib/error/ to see how this should be done.
If you want to use the built-in error and exception handling but extend it by your own functionality, simply derive your class from the error and exception handling classes shipped with TYPO3 and register this class as error (exception) handler.
Example:
class tx_postExceptionsOnTwitter extends t3lib_error_DebugExceptionHandler {
function echoExceptionWeb(Exception $exception) {$this->postExceptionsOnTwitter($exception);
}
function postExceptionsOnTwitter($exception) {// do it ;-)
}
}
$TYPO3_CONF_VARS['SYS']['debugExceptionHandler'] = 'tx_postExceptionsOnTwitter';$TYPO3_CONF_VARS['SYS']['productionExceptionHandler'] = 'tx_postExceptionsOnTwitter';
