Zoph/Solving Problems/Debug

From Wikibooks, open books for an open world
Jump to navigation Jump to search

In case something goes wrong and Zoph's normal error reporting does not give sufficient information to solve the problem, you can enable debugging. Debugging is controlled through 3 different options in config.inc.php:

This will allow for granular debugging. This debugging mechanism will give you control over which messages are displayed and which not. Because the logging will be generated while Zoph is processing the page, debug messages will be displayed all over the page. This may sometimes cause Javascript, XML or Redirects to stop working, however, it will also make it easier to figure out where the problem occurred.

Log Subjects[edit | edit source]

Each logging message has been categorized in a subject:

Message subjects
log::ALL All messages
log::VARS Messages regarding setting of variables
log::LANG Messages regarding the translation of Zoph
log::LOGIN Messages regarding the Login procedure
log::REDIRECT Messages regarding redirection
log::DB Messages regarding the database connection
log::SQL Messages regarding SQL Queries
log::XML Messages regarding XML creation
log::IMG Messages regarding image creation
log::IMPORT Messages regarding the import functions
log::GENERAL Other messages
log::NONE No messages.

Log Severity[edit | edit source]

and each message has gotten a severity indiction, that indicates how "bad" the situation is:

Severity indications
log::DEBUG Debugging messages, Zoph gives information about what it's doing.
log::NOTIFY Notification about something that is happening which is influencing Zoph's program flow
log::WARN Warning about something that is happening
log::ERROR Error condition, something has gone wrong, but Zoph can recover
log::FATAL Fatal error, something has gone wrong and Zoph needs to stop execution of the current script.
log::NONE Do not display any messages

Configuration[edit | edit source]

As mentioned before, 3 new configuration options have been added to config.inc.php.

LOG_ALWAYS[edit | edit source]

This setting configures a log level that is always displayed, no matter which subject the message is in. By default this is set to log::FATAL, which means that any message that has a severity of FATAL or worse is displayed. Since log::FATAL is the worst kind of message, only log::FATAL messages will be displayed. If you would set it to log::WARN, any message with a severity of WARN or worse will be displayed, hence any FATAL, ERROR or WARN message will be displayed. A special severity level has been added to suppress all messages: log::NONE

Examples[edit | edit source]

define('LOG_ALWAYS', log::ERROR);

All messages which indicate an error or a fatal error will be displayed.

define('LOG_ALWAYS', log::NOTIFY);

All messages, except debug-level messages will be displayed.

define('LOG_ALWAYS', log::DEBUG);

All messages will be displayed.

LOG_SEVERITY[edit | edit source]

This setting works in the same way as the previous one, except that only messages for a specific severity will be displayed; it is used in combination with LOG_SUBJECT to achieve this.

Examples[edit | edit source]

define('LOG_SEVERITY', log::ERROR);
define('LOG_SUBJECT', log::LANG);

All messages which indicate an error or a fatal error, regarding the translation of Zoph will be displayed.

define('LOG_SEVERITY', log::NOTIFY);
define('LOG_SUBJECT', log::DB);

All messages, except debug-level messages, regarding the database connection will be displayed.

define('LOG_SEVERITY', log::DEBUG);
define('LOG_SUBJECT', log::SQL);

All messages regarding SQL-queries will be displayed. (since the SQL queries themselves are considered debug information, you will need this setting to show them.)

LOG_SUBJECT[edit | edit source]

With this setting you can control for which subjects you want to see the messages. There is a special subject to show all messages: log::ALL.

You can also combine multiple subjects, using the | (or) sign and the ~ (not) sign.

Examples[edit | edit source]

define('LOG_SEVERITY', log::ERROR);
define('LOG_SUBJECT', log::LANG | log::IMG);

All messages which indicate an error or a fatal error, regarding the translation of Zoph or images will be displayed.

define('LOG_SEVERITY', log::NOTIFY);
define('LOG_SUBJECT', log::ALL | ~log::SQL);

All messages, except debug-level messages, except those regarding SQL queries are displayed.

define('LOG_SEVERITY', log::DEBUG);
define('LOG_SUBJECT', log::ALL ~(log::REDIRECT | log::DB));

All messages except those regarding redirects or the database connection will be displayed.