MapServer Logging
Steps to Enabling MapServer Debugging
In order to enable MapServer debugging you need to perform the following steps:
- Set the MS_ERRORFILE variable
- Set the DEBUG parameter [ OFF | ON | 0 | 1 | 2 | 3 | 4 | 5 ]
Setting the MS_ERRORFILE variable
This variable defines the name and location of the MapServer .log file. The recommended way to set the MS_ERRORFILE variable is in your .MAP file, within the MAP object e.g.
MS_ERRORFILE variable
MAP ... CONFIG MS_ERRORFILE "..\..\..\mapserver\tmp\overlays.map.error.log" ... END
Setting the DEBUG parameter
You can place the DEBUG parameter in any LAYER in the .MAP file, or instead, set it once in the MAP object so that it applies to each layer e.g.
DEBUG parameter
MAP ... CONFIG MS_ERRORFILE "..\..\..\mapserver\tmp\overlays.map.error.log" DEBUG 5 ... LAYER ... END END
Â
Use the value of the DEBUG parameter to set the type of information returned, as follows:
- Level 0 - Errors only (DEBUG OFF, or DEBUG 0) - only msSetError() calls are logged to MS_ERORFILE. No msDebug() output at all. This is the default.
- Level 1 - Errors and Notices (DEBUG ON, or DEBUG 1) - Level 0 plus msDebug() warnings about common pitfalls, failed assertions or non-fatal error situations (e.g. missing or invalid values for some parameters, missing shapefiles in tileindex, timeout error from remote WMS/WFS servers, etc.)
- Level 2 - Map Tuning (DEBUG 2) - Level 1 plus notices and timing information useful for tuning mapfiles and applications. this is the recommended minimal debugging level.
- Level 3 - Verbose Debug (DEBUG 3) - Level 2 plus some debug output useful in troubleshooting problems such as WMS connection URLs being called, database connection calls, etc.
- Level 4 - Very Verbose Debug (DEBUG 4) - Level 3 plus even more details...
- Level 5 - Very Very Verbose Debug (DEBUG 5) - Level 4 plus any msDebug() output that might be more useful to developers than to users.