Solution #2:

Defer the debugging to the end of the page

Debug.0 = 0
C = 'L'
-- lots of stuff here…
Call Debug 'C='c'
Say 'The time is' time(C)

If debug.0 > 0 then do
  Say '<H2>Debug:</H2>
  Do I = 1 to debug.0
    Say debug.i'<BR>'
    End
  End
Exit

Debug:
Debug.0 = Debug.0 + 1; Debug.[debug.0] = arg(1)
Return

Result:

The time is 13:43:28.484793

Debug:

C=L

Problems:

  1. The debugging is always on
  2. If the data contains an "<" then it will be interpreted as HTML
  3. Once you've found the problem you have to take the debugging out