WCF is such a nice framework, and its diagnostics capabilities are really comprehensive. Really, I only have two (pseudo-)issues with diagnostics so far:
- Configuring diagnostics is pretty difficult to do (lots of XML editing involved)
- Reading trace and message logs is hard. By default, it’s in XML, so it’s ‘human-readable’, but there’s just so much of it that it becomes nigh-unreadable in reality
In both cases, the answer is a tool, and such tools actually exist: The Service Configuration Editor (SvcConfigEditor.exe) addresses the first point, and the Service Trace Viewer (SvcTraceViewer.exe) the second. Both are part of the SDK and can be found in “C:\Program Files\Microsoft SDKs\Windows\v6.0\Bin” (or whereever your SDK is installed).
The only problem with this is that in production (or staging or test) environments, the SDK isn’t typically installed, and nor should it be. Alas, this also means that those two very useful tools aren’t available either, which makes troubleshooting on a production client or server much harder.
After a couple of days of manually copying configuration and trace files back and forth between my laptop and the test server I was troubleshooting, the obvious solution hit me. It’s so simple that you probably already know this trick, and if that’s the case, I apologize for having made you read this far.
Both the Service Configuration Editor and Service Trace Viewer tools are .NET applications, and since they don’t have any fancy dependencies (apart from .NET 3.0), you can deploy them via xcopy. While I don’t particularly recommend that you copy them to your production servers or random clients, you can copy them to a USB stick that you can carry around.
Whenever you need to use these tools, but don’t have the SDK installed on a machine, you can just plug the USB drive in the machine and run the tools from there.
There you have it: You may have figured this out long ago, but for those of you who are as slow as me, I hope this little trick can save you some time.