Monday, 21 January 2013

MapGuide tidbits: FDO RDBMS provider trace logging

From the "I wished they told us about this in the documentation" department:

Ever wanted to see the SQL that your RDBMS-based FDO provider is executing behind the scenes?

Any provider built on top of the GenericRdbms core supports trace logging of SQL statements. For reference, the providers are:
  • OSGeo.ODBC
  • OSGeo.MySQL
  • OSGeo.SQLServerSpatial
  • OSGeo.PostgreSQL
Here's how you enable such tracing.
  1. From the command-line, define a FDO_TRACE_FILE environment variable that points to a file where you want such statements logged. (eg. SET FDO_TRACE_FILE=C:\temp\fdo_trace.log)
  2. Run your FDO client application from the same command line. Obviously for MapGuide, this means you have to run it interactively (ie. mgserver.exe run) instead of a service, which is the same thing we do if we want to inspect WMS/WFS traffic through fiddler.
Now when you interact with any Feature Source using any one of the above providers, you can see the full gory SQL that the provider is generating in the trace log file


For commerical providers like the Autodesk.Oracle provider, the environment variable is GVC_TRACE_FILE.

No comments: