[mapserver-users] DEBUG statement - lets actually do something about it!

Steve Lime steve.lime at dnr.state.mn.us
Mon Oct 7 16:03:46 PDT 2002


I'll add this to the 3.7 development tree (tonite I hope). We can talk
about it's use in future emails...

Steve

Stephen Lime
Data & Applications Manager

Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155
651-297-2937

>>> david blasby <dblasby at refractions.net> 10/01/02 12:11PM >>>
We've had a few discussion about having a mapfile-wide "DEBUG on/off"
and LAYER-level "DEBUG on/off".

I dont think much has actually come of this (did I miss something?). 
I
think it would be very useful for, at least, the
PostGIS layer to have it report the SQL statement it's executing and
what kind of indexes its using.  I'm sure other portions of mapserver
would appreciate it too.

Proposal
-------------

Change the parser so it handles layers like:

LAYER
    DEBUG on/off
    ...
END

DEBUG will default to "off".

Add, to layerObj, a boolean debug flag:
        char        debug; //boolean: false = no debug info, true =
write debugging info to stderr

It would be wise to add (also to map.h) a constant so new code is
compatible with older version of layer:
#DEFINE LAYERHASDEBUGFLAG


Then in layer functions, one can do something like:

#ifdef LAYERHASDEBUGFLAG
   if (layer->debug)
    {
         printf(stderr,"POSTGIS layer opening\n");
        // report DATA statement
        // report CONNECTION information
        // execute an EXPLAIN command to get the query plan & report
       // execute EXPLAIN VERBOSE, parse and report more information
about the query
       // query DB and report all the indexes on the appropriate
tables
      //  query pg_stats and ensure the DB statistical analysis is
up-to-date
        // ....
    }
#endif


Alternatively, we could have DEBUG be off/on/full (0/1/128) to provide
a
bit more control over how much debugging is done.
--------
I understand that this isn't necessarily the best way, but we've had
this discussion a few times and we have almost nothing.  At least this
way we'll have something.  And it shouldn't take very long (I'd do it
myself, but I dont want to mess around with the parser).

What say?

dave




More information about the MapServer-users mailing list