[mapserver-users] Proposal: "DEBUG true" for layers

Stephen Lime steve.lime at dnr.state.mn.us
Wed Jan 16 13:46:52 EST 2002


Actually there is another debuging tool. You can set  an environment variable called MS_ERRORFILE
to point to a file (or stderr,stdout) and all calls to msSetError(...) are logged there along with a timestamp.
You can plop msSetError calls strategically in the code for debugging. This is server-wide, but might be 
particularly effective in combination with a mapfile based debug flag which could unlock more complete 
messaging as in Dave's example. I'd be in favor of a map level (i.e. DEBUG in the outtermost object) if 
anything. You need to control where to write the debugging messages so although this is two steps:
1) set error file location and 2) set debug variable you'd have total control on any platform.

Steve

Stephen Lime
Data & Applications Manager

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

>>> Daniel Morissette <morissette at dmsolutions.ca> 01/16/02 12:15PM >>>
Dave, and all,

Why not have the DEBUG flag in the web object instead so that it applies
to all of MapServer.  There are other situations (outside of layer
context) where some debug information could be useful.

Actually, there is already a LOG paramater in the WEB object but I don't
think it does much.  Perhaps instead of a DEBUG flag, the LOG parameter
could be used to control debug output, and the LOG value if it is set
would be the filename where the debug output should be sent.

BTW, about using fprintf(stderr, ...), using this makes Apache hang on
Windows in some circumstances, so we have implemented a msDebug()
function in maperror.c that takes printf-style arguments and that we use
instead.  It writes to stderr on Unix, and simply does nothing on
Windows.  

If we were to implement DEBUG or LOG support then I think all the debug
and logfile logic should be contained in that function and your code
would simply call msDebug().  And of course the Windows case in
msDebug() would have to be fixed.

Just my 0.02$

Daniel
-- 
------------------------------------------------------------
 Daniel Morissette               morissette at dmsolutions.ca 
 DM Solutions Group              http://www.dmsolutions.ca/ 
------------------------------------------------------------
  Don't put for tomorrow what you can do today, because if 
      you enjoy it today you can do it again tomorrow.


Dave Blasby wrote:
> 
> I'm getting a several questions from people regarding why certain SQL
> statements are not functioning as expected with the PostGIS connector.
> I'm sure the folk doing the oraclespatial and SDE would appreciated this
> as well.
> 
> I'd like to add code like:
> 
> if (layerinfo->debug)
> {
>         fprintf(stderr,"the sql statement was: %s\n", sql);
> }
> 
> To do this:
> 1. Add another item to the layerObj structure
>                 char            debug;    //default = false.  true=print out debug info for this
> layer
> 2. Add code to the parser to hand the "DEBUG true/false" option for
> layers.  Default should be false.
> 
> I'd do it myself, but I dont want to mess with the parser.
> 
> Do folk think this is worth adding?
> 
> dave






More information about the mapserver-users mailing list