| t | | t | |
| <table align="right"><tr><td><div class="toc"> | | |
| Contents: | | |
| <ul> | | |
| <ul> | | |
| <li><a href="#debug_and_diagnostic_messages">debug and diagnostic messages</a></li> | | |
| <li><a href="#debug_log">debug log</a></li> | | |
| <ul> | | |
| <li><a href="#activating_the_debug_log_from_configuration_file">activating the debug log from configuration file</a></li> | | |
| <li><a href="#activating_the_debug_log_by_URL">activating the debug log by URL</a></li> | | |
| <li><a href="#debug_log_extra_string">debug log extra string</a></li> | | |
| </ul> | | |
| </ul> | | |
| </ul> | | |
| </div></td></tr></table> | | |
| <p> | | |
| This page describes how to bebug a tbwiki instance. | | |
| <p> | | |
| <h2><a name="debug_and_diagnostic_messages">debug and diagnostic messages</a> | | |
| <span align=right class="section_edit_link">[<a href="/tbwiki/DocDebug?action=edit§ion=debug_and_diagnostic_messages">edit section</a>]</font></span> | | |
| </h2> | | |
| Inside the wiki code itself, use <code>req.add_to_message()</code> to show a message | | |
| that will appear in the client browser | | |
| <p> | | |
| <h2><a name="debug_log">debug log</a> | | |
| <span align=right class="section_edit_link">[<a href="/tbwiki/DocDebug?action=edit§ion=debug_log">edit section</a>]</font></span> | | |
| </h2> | | |
| tbwiki supports a debug log, which is found at: | | |
| <p> | | |
| <code>req.config.data_dir + "tbwiki-debug.log"</code> | | |
| <p> | | |
| Entries can be added to the debug log by calling the <code>req.debug_log(msg)</code> function. This can be called from anywhere in tbwiki_engine.py, any | | |
| Macro or Processor, or the associated auxiliary modules (datascan, table, etc.) | | |
| <p> | | |
| <h3><a name="activating_the_debug_log_from_configuration_file">activating the debug log from configuration file</a> | | |
| <span align=right class="section_edit_link">[<a href="/tbwiki/DocDebug?action=edit§ion=activating_the_debug_log_from_configuration_file">edit section</a>]</font></span> | | |
| </h3> | | |
| In cgi-bin/<wiki_name>.cgi, set the <code>do_debug</code> variable | | |
| in the config class instance, like so: | | |
| <p> | | |
| <ul><div style="background-color:#ffffe0; padding:5px; border-style: solid solid solid solid; border-width: 1px 1px 1px 1px;"> | | |
| <pre>config.do_debug = True</pre></div></ul> | | |
| | | |
| <p> | | |
| This should be done before calling main(req) in the .cgi file. | | |
| <p> | | |
| <h3><a name="activating_the_debug_log_by_URL">activating the debug log by URL</a> | | |
| <span align=right class="section_edit_link">[<a href="/tbwiki/DocDebug?action=edit§ion=activating_the_debug_log_by_URL">edit section</a>]</font></span> | | |
| </h3> | | |
| You can also activate this by adding "?debug=true" to any valid wiki URL. | | |
| <p> | | |
| For example: <a href="https://bird.org/tbwiki/FrontPage?debug=true">https://bird.org/tbwiki/FrontPage?debug=true</a> | | |
| <p> | | |
| <ul><div style="background-color:#ffffe0; padding:5px; border-style: solid solid solid solid; border-width: 1px 1px 1px 1px;"> | | |
| <pre>2024-11-04_17:32:42.20 - in main(), action='show'</pre></div></ul> | | |
| | | |
| <p> | | |
| <h3><a name="debug_log_extra_string">debug log extra string</a> | | |
| <span align=right class="section_edit_link">[<a href="/tbwiki/DocDebug?action=edit§ion=debug_log_extra_string">edit section</a>]</font></span> | | |
| </h3> | | |
| If you specify an string for the value of "debug" other than "true", | | |
| then this will appear in log entries for that URL response. | | |
| <p> | | |
| For example: <a href="https://bird.org/tbwiki/FrontPage?debug=testing_front_page_url">https://bird.org/tbwiki/FrontPage?debug=testing_front_page_url</a> | | |
| <p> | | |
| Results in (at least) the following log entry: | | |
| <ul><div style="background-color:#ffffe0; padding:5px; border-style: solid solid solid solid; border-width: 1px 1px 1px 1px;"> | | |
| <pre>2024-11-04_17:32:42.20 - [testing_front_page_url] in main(), action='show'</pre></div></ul> | | |
| | | |
| <p> | | |