Backend Debugging

The CONTENIDO backend has a few options to make debugging easier.

Available Settings

You can find the debug settings for the backend on the system configuration page (Administration > System > System Configuration):

You can choose any of the two debug settings or both of them.

Debug to File

If this checkbox is active, CONTENIDO will output all debug information to a file called "debug.log" in /data/logs/. This will look similar to this:

...
*****includes/include.systemsettings.php*****
2013-10-02 14:31:34: Files:
Array
(
    [main] => Array
        (
            [0] => includes/include.system_configuration.php
        )
)
Actions:
Array
(
    [edit_sysconf] =>
)
Information:
Area: system_configuration
Action:
Client: 1
Lang: 1
2013-10-02 14:31:34: Building this page (excluding CONTENIDO includes) took: 0.10946297645569 seconds
Building the complete page took: 0.35798406600952 seconds
Include memory usage: 1.55 MiB
Complete memory usage: 6.11 MiB
...

You can quickly identify the variables that CONTENIDO used to determine which file should be loaded. It also includes information about memory usage and execution time.

Visible Debugging

If this checkbox is set, the same information that is written to the debug log will be shown in the upper right hand corner of the CONTENIDO backend:

Since the space there is very limited, you can click "Select all" to highlight the whole debug log. This way you can easily copy and paste it into another document (like a post on a forum for example).

Creating Custom Debug Messages

When you are writing a CONTENIDO plugin it might be useful to you to output custom debug messages in certain situations. The class "cDebug" takes care of that. Simply use

cDebug::out("Some kind of informative debug message");

to output something to the activated debug channels.

Another helpful function for this feature is the function buildStackString which will produce an output like:

addScript() called in file include.lang_edit.php(209)
include_once() called in file main.php(186)

This stack trace can be extremly helpful to identify which part of your code is producing the debug message.

More Information

If you want to know more about the cDebug class you can take a look at it in CONTENIDO's API documentation and especially the part about cDebug and the debug package.