Product SiteDocumentation Site

5.36. System Logging and Debugging

This section describes settings which can be used to troubleshoot MantisBT operations as well as assist during development.
$g_show_timer
Time page loads. The page execution timer shows at the bottom of each page.
Default is OFF.
$g_show_memory_usage
Show memory usage for each page load in the footer.
Default is OFF.
$g_debug_email
Email address to use for debugging purposes.
This option is used for debugging problems with the email features in mantis, and can be set to a valid email address.
This is blank by default, meaning that email notifications are sent to their intended recipients (normal system behavior).
If set, emails will only be sent to the specified address instead, and the original recipients (To, Cc and Bcc) will be included in the message body.
Default is ''.
$g_show_queries_count
Shows the total number/unique number of queries executed to serve the page.
Default is OFF.
$g_display_errors
Errors Display Method. Defines what errors are displayed and how. Available options are:
DISPLAY_ERROR_HALT
Stop and display the error message (including variables and backtrace if $g_show_detailed_errors is ON).
DISPLAY_ERROR_INLINE
Display a one line error and continue execution.
DISPLAY_ERROR_NONE
Suppress the error (no display). This is the default behavior for unspecified errors constants.
The default settings are recommended for use in production, and will only display MantisBT fatal errors, suppressing output of all other error types.
Recommended config_inc.php settings for developers:
$g_display_errors = array(
	E_WARNING           => DISPLAY_ERROR_HALT,
	E_ALL               => DISPLAY_ERROR_INLINE,
);

Note

The system automatically sets $g_display_errors to the above recommended development values when the server's name is localhost.
Less intrusive settings, recommended for testing purposes:
$g_display_errors = array(
	E_USER_WARNING => DISPLAY_ERROR_INLINE,
	E_WARNING      => DISPLAY_ERROR_INLINE,
);

Note

E_USER_ERROR, E_RECOVERABLE_ERROR and E_ERROR will always be set to DISPLAY_ERROR_HALT internally, regardless of the actual configured value. This ensures that program execution stops, to prevent potential integrity issues and/or MantisBT from functioning incorrectly.
$g_show_detailed_errors
Shows a list of variables and their values, as well as an execution stack trace whenever a fatal error is triggered.
Only applies to error types configured to DISPLAY_ERROR_HALT in $g_display_errors.
Default is OFF.

Warning

Setting this to ON is a potential security hazard, as it can expose sensitive system information. Only enable it when needed for debugging purposes.
$g_stop_on_errors
Prevent page redirections when non-fatal errors occur.
If this option is turned OFF (default) page redirects will function normally, preventing display of non-fatal error messages.
It should only be set to ON during development or for debugging purposes. This will prevent page redirections, allowing you to see the errors.
Default is OFF.

Note

Non-fatal errors are those configured as DISPLAY_ERROR_INLINE in $g_display_errors.
$g_log_level
The system logging interface is used to extract detailed debugging information for the MantisBT system. It can also serve as an audit trail for users' actions.
This controls the type of logging information recorded. Refer to $g_log_destination for details on where to save the logs.
The available log channels are:
LOG_NONE
Disable logging
LOG_AJAX
logs AJAX events
LOG_DATABASE
logs database events and executed SQL queries
LOG_EMAIL
logs issue id, message type and recipients for all emails sent
LOG_EMAIL_VERBOSE
Enables extra logging for troubleshooting internals of email queuing and sending.
LOG_EMAIL_RECIPIENT
logs the details of email recipient determination. Each user id is listed as well as why they are added, or deleted from the recipient list
LOG_FILTERING
logs filter operations
LOG_LDAP
logs the details of LDAP operations
LOG_WEBSERVICE
logs the details of Web Services operations (e.g. SOAP API)
LOG_PLUGIN
Enables logging from plugins.
LOG_ALL
combines all of the above log levels
Default is LOG_NONE.

Note

Multiple log channels can be combined using PHP bitwise operators , e.g.
$g_log_level = LOG_EMAIL | LOG_EMAIL_RECIPIENT;
or
$g_log_level = LOG_ALL & ~LOG_DATABASE;
$g_log_destination
Specifies where the log data goes. The following five options are available:
''
The empty string means default PHP error log settings
'none'
Don't output the logs, but would still trigger EVENT_LOG plugin event.
'file'
Log to a specific file, specified as an absolute path, e.g. 'file:/var/log/mantis.log' (Unix) or 'file:c:/temp/mantisbt.log' (Windows)

Note

This file must be writable by the web server running MantisBT.
'page'
Display log output at bottom of the page. See also $g_show_log_threshold to restrict who can see log data.
Default is '' (empty string).
$g_show_log_threshold
Indicates the access level required for a user to see the log output.
This is only used when $g_log_destination is 'page'.
Default is ADMINISTRATOR.

Note

This threshold is compared against the user's global access level rather than the one from the currently active project.