Wednesday, 6 June 2012

Logging MapGuide Web Tier requests and errors

MapGuide being a 3-tier application means there are potentially 3 places where things can go wrong, and when things go wrong, you want to make sure that there is at least some kind of logging in place to help you diagnose the what, who, when, where and why.

While Firebug and extensive logging capabilities cover the client and server tiers quite comfortably, you might be wondering, about the Web Tier, which there isn't much talk about and also happens to be the most important tier as it is the tier where all client to server and server to client communications must go through. If the Web Tier falls over, you will have no client-server communication and you sure as hell want to be able to look at any logs that can tell you why this is the case.

Fortunately, since MapGuide Open Source 2.2 the web tier has logging capabilities built in, but this is disabled by default when installed. Here's how you can enable it.

Open the webconfig.ini file in your MapGuide/AIMS installation and look for the AgentProperties section. In there, set the ErrorLogEnabled property to 1. If you want requests logged as well, set RequestLogEnabled to 1 as well

The logs will be written to the specified ErrorLogFilename and RequestLogFilename values in the directory specified by the LogsPath property.

Here's a sample of some logged requests by the web tier

And here's a sample of some logged errors by the web tier. Looks pretty much the same as the server error logs.

Once you have made your changes, save the file and restart your Apache/IIS for the web tier to be able to pick up the newly modified configuration. For IIS, an application pool recycle should be sufficient.

No comments: