part of the ArsDigita Community System, by Jon Salz
- Admin interface: /www/admin/monitoring/request-info.tcl
- Procedures: /packages/developer-support-procs.tcl, with support in:
The Big Picture
Software development is a big feedback loop: a developer writes something, tests it, and
then repeats until the results are satisfactory. It's important to streamline this cycle
by having a development environment which makes it easy to analyze what the software is
doing under the hood.
Peeking Under the Hood
Our development environment previously consisted largely of Emacs, and tail -f
/web/servername/log/servername-error.log. Now this has been augmented:
ad_footer and ad_admin_footer now display a link entitled
Developer Information. (You can use the ds_link procedure to generate the
link yourself.) Following the link displays a screenful of information
- The times that the request started and ended, and its duration (with millisecond accuracy).
- The request parameters (method, url, query, headers, etc.).
- The output headers, if any.
- Information about all database queries performed while loading the page, including
their respective durations (with millisecond accuracy).
In addition, the ClientDebug facility of AOLserver 2 has been re-implemented in the
abstract URL system (which serves nearly all non-static pages).
If an errors occurs while serving a page, a stack trace is printed out.
Note that these nifty features pop up only when you are logged in as a site-wide
administrator! Revealing this information to anyone else would pose a huge security
Developer support is not currently enabled on this server.
Here's an example of what the
report looks like.
Tired of using ns_log to instrument your code, then grokking the error log
to see what's wrong with your page? Use the ds_comment routine instead:
Your comment will show up at the bottom of the page, beneath the Developer Information
link (but only for site-wide administrators). It will also be displayed on the
Developer Information page itself.
ds_comment "Foo is $foo"
Comments are displayed even if an error occurs in the page!
Add the following to your
Note that you may not want to enable this stuff for production systems - they probably
incur a slight performance hit (although this hasn't been benchmarked).
; remember information about connections, for developers' benefit?
; remember information about every database request?
; remember information for which client hosts?
; remember this information for how long? sweep how often? (in seconds)
How It Works
The security subsystem registers preauth and trace filters which store relevant
connection information in shared variables (nsvs). The security subsystem
also renames the AOLserver ns_db procedure and registers a wrapper
which aggregates information about database queries.