I’ve shown you all of the basics you need to incorporate logging into your scripts. Be sure to check out the second part of this series, “Error Trapping and Capturing Third-Party Output” to learn how to make your log files more effective.
Be sure to download the code source for this article. In it you will find a complete logging script with ready to use subroutines. You can use them as is or customize them to your liking. Either way they should provide you with a good foundation for adding logging to your scripts.
In the second part of this article you will learn how to effectively trap execution errors in your code with VBScript’s Err object, how to log information to the system’s Application Event Log, and how to capture the output of third-party programs executed by your script.
My hope is that this series will aid you in becoming better code writers. Proper error-handling and logging are two of the techniques that make your code much more useful and more professional. You should try to incorporate this into all of your scripts. Stick around for part two. Until next time, keep coding!
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |