ASP
  Home arrow ASP arrow Useful Error Handling And Logging In Scrip...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Mobile Linux 
App Generation ROI 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
ASP

Useful Error Handling And Logging In Script
By: Steve Schofield
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 11
    2003-08-06

    Table of Contents:
  • Useful Error Handling And Logging In Script
  • Logging To A Text File
  • Error Handler

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Useful Error Handling And Logging In Script


    (Page 1 of 3 )

    Here is a couple of functions that are useful when debugging using Windows Scripting Host files. Notice in every function, ON ERROR RESUME NEXT and ERR.CLEAR is called. When using WSH or any script language, the rich debugging environment isn't available. Being able to debug your scripts and continue to the completion is a real challenge.
    This technique has been useful in several hundred line script files that I've done. Notice in Function SAMPLE, 1 - this will log to a file on the c:\TrackingLog.txt, 2 and if there are any errors inside the function, all errors will Log right after what function was called also to the c:\trackingLog.txt. You can add whatever functionality you like to the Error Handler. This has been useful to me anyway! Any questions give me a shout!

    Put these as global functions at the top of your windows scripting host

     Set WshShell WScript.CreateObject("WScript.Shell"Set WshNetwork WScript.CreateObject("Wscript.Network"Set FSO CreateObject("Scripting.FileSystemObject") Function Sample() On Error Resume Next Err.Clear AddToLog('-Starting the Sample Function') ....rest of the codeEnd Function Write to a Text file 

    More ASP Articles
    More By Steve Schofield


     

    ASP ARTICLES

    - Using MySQL with ASP
    - ADO for the Beginner
    - ADO.NET 101: Data Rendering with a DataGrid ...
    - Introducing SoftArtisans OfficeWriter 3.0 En...
    - Getting Remote Files With ASP
    - The Real Basics of Functions in ASP
    - Enhancing Readability with ASP
    - Mimicking PHP's String Formatting Functions
    - Windows Server Hacks 12, 77, and 98
    - How to Sort a Multi-Dimensional Array
    - Developing an Information Management Tool wi...
    - What are Active Server Pages?
    - Getting Remote Pages with ASP
    - FTP’ing Files with ASP
    - Apply Single-Sign-On to Your Application





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
    Stay green...Green IT