in reply to Defensive Programming and Audit Trails
First, verbose levels work. They allow you to run production software in a very chatty mode at the drop of a hat. More, you are 99.9% certain that your logging is not hiding the error. (But beware that .1%; and yes, that is the voice of experience that you're hearing.)
Also, don't be afraid to print and use return codes. At one time I considered myself too clever for such things, I could work things out programmatically, etc. "How terribly procedural! I, being a super-genius, shall write methods/functions/whatever to handle that!" In other words, I was young and therefore stupid; I had to get knocked on my gluteus maximus before I realized the value of this. Also, try printing any key values in the message. This can confirm quickly that everything was working up to the point of the error message, or that something went wrong beforehand.
Also, if you are rolling your own error messages, write those messages in such a way that they are easily differentiated from the surrounding, normal logging, yet can be differentiated from one another easily. This allows you to do quick checking with, say, a Perl script.
Oh, and if error logs in XML are not the work of Satan, then it's only because he has subcontracted them.
As God is my witness, I thought turkeys could fly.