Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Produce a listing describing the executing environment for post-mortem debugging and tech-support

Debugging and Tuning

Produce a listing describing the executing environment for post-mortem debugging and tech-support

by  wgcs  Posted    (Edited  )
Some suggestions from thread184-719449 courtesy of pcwc66
along with some of my own methods: (please email me with more ideas... I'll probably be creating a function here for producing the log file shortly)

I keep several log files: One that is added to at each crash and which contains basic necessities at the time of the crash, and two others, one resulting from "LIST MEMORY TO ErrMem.txt", and one from "LIST STATUS TO ErrStat.txt". The reason for separate files is that the main error log file is kept to a minimum size: The LISTings can produce very large files that if they were appended at every error might result in a huge log file (particularly when a single annoying, but not disabling, error happens repeatedly and is frequently "ignore"ed)

When a customer calls for tech support, if the problem isn't clear, these three files can be emailed to provide the state of the application at the time of the crash.

[ul]
[li]In the main error log, I want:
[ul][li]program version:global variable value
[li]program name: PROGRAM(0) ... sometimes these logs come in with no explanation, particularly with our automatic web-based error reporting
[li]date and time: TTOC(DATETIME())
[li]Call Stack (see below)
[li]procedure throwing the error (sys(16) in ON ERROR parameter) and the line number (LINENO() in ON ERROR parameter)
[li]error MESSAGE()
[li]instruction causing the error..MESSAGE(1)
[li]current drive and directory: SET('DEFA')+CURDIR()
[li]currently selected ALIAS() and the DBF() behind it
[li]SET('DATASESSION')
[li]Now, I add a 'debug trace' of the last several menu choices that have been chosen (which are added to a global array in a stub-procedure that launches each menu choice).
[/ul]
[li]Other things that are important:
[ul][li]Domain/computer Info:
[ul] [li]getenv("USERDOMAIN")
[li]getenv("COMPUTERNAME")
[li]api: GetComputerName
[li]api: NetServerGetInfo
[li]api: GetHostName
[li]sys(0)
[li]api: IP Address: GetHostByName
[li]api: InetAddr
[/ul]
[li]Login Name
[ul] [li]getenv("USERNAME")
[li]api: GetUserName
[li]api: WNetGetUser
[li]sys(0)
[/ul]
[li]OS
[ul] [li]OS()
[li]getenv("OS")
[li]api: NetServerGetInfo
[li]Sysinfo.ocx
[/ul]
[li]CPU/Memory
[ul] [li]getenv("PROCESSOR_IDENTIFIER")
[li]api: GetSystemInfo
[li]api: GlobalMemoryStatus
[li]api: Diskspace( , 0) and Diskspace( , 1)
[li]getenv("NUMBER_OF_PROCESSORS")
[li]api: GetSystemInfo
[li]Resolution: sysmetric(1) and sysmetric(2)
[/ul]
[li]DLL/EXE File Version Info:
[ul] [li]api:1. AGetFileVersion()
[/ul]
[li]VFP Operating Environment:
[ul][li]Call Stack:
Code:
     ep_lev = 1
     \ Call Stack:
     do while !empty( program( ep_Lev ) )
       \   << Program( ep_Lev ) >>
       ep_Lev = ep_Lev+1
     enddo
[li]Environment Variables:
Code:
   \ Environment Variables:
   \\<<iif(empty(GetEnv("OS")),                    ',Chr(13)+chr(10)+"OS="                   +GetEnv("OS"))>>
   \\<<iif(empty(GetEnv("SystemRoot")),            ',Chr(13)+chr(10)+"SystemRoot="           +GetEnv("SystemRoot"))>>
   \\<<iif(empty(GetEnv("windir")),                ',Chr(13)+chr(10)+"WinDir="               +GetEnv("WinDir"))>>
   \\<<iif(empty(GetEnv("TEMP")),                  ',Chr(13)+chr(10)+"TEMP="                 +GetEnv("TEMP"))>>
   \\<<iif(empty(GetEnv("TMP")),                   ',Chr(13)+chr(10)+"TMP="                  +GetEnv("TMP"))>>
   \\<<iif(empty(GetEnv("Path")),                  ',Chr(13)+chr(10)+"PATH="                 +GetEnv("Path"))>>
  
   \\<<iif(empty(GetEnv("ALLUSERSPROFILE")),       ',Chr(13)+chr(10)+"ALLUSERSPROFILE="      +GetEnv("ALLUSERSPROFILE"))>>
   \\<<iif(empty(GetEnv("APPDATA")),               ',Chr(13)+chr(10)+"APPDATA="              +GetEnv("APPDATA"))>>
   \\<<iif(empty(GetEnv("CLASSPATH")),             ',Chr(13)+chr(10)+"CLASSPATH="            +GetEnv("CLASSPATH"))>>
   \\<<iif(empty(GetEnv("CommonProgramFiles")),    ',Chr(13)+chr(10)+"CommonProgramFiles="   +GetEnv("CommonProgramFiles"))>>
   \\<<iif(empty(GetEnv("COMPUTERNAME")),          ',Chr(13)+chr(10)+"ComputerName="         +GetEnv("ComputerName"))>>
   \\<<iif(empty(GetEnv("ComSpec")),               ',Chr(13)+chr(10)+"ComSpec="              +GetEnv("ComSpec"))>>
   \\<<iif(empty(GetEnv("HOMEDRIVE")),             ',Chr(13)+chr(10)+"HomeDrive="            +GetEnv("HOMEDRIVE"))>>
   \\<<iif(empty(GetEnv("HOMEPATH")),              ',Chr(13)+chr(10)+"HomePath="             +GetEnv("HOMEPATH"))>>
   \\<<iif(empty(GetEnv("LOGONSERVER")),           ',Chr(13)+chr(10)+"LogonServer="          +GetEnv("LOGONSERVER"))>>
   \\<<iif(empty(GetEnv("PATHEXT")),               ',Chr(13)+chr(10)+"PathExt="              +GetEnv("PATHEXT"))>>
   \\<<iif(empty(GetEnv("ProgramFiles")),          ',Chr(13)+chr(10)+"ProgramFiles="         +GetEnv("ProgramFiles"))>>
   \\<<iif(empty(GetEnv("SystemDrive")),           ',Chr(13)+chr(10)+"SystemDrive="          +GetEnv("SystemDrive"))>>
   \\<<iif(empty(GetEnv("PROMPT")),                ',Chr(13)+chr(10)+"Prompt="               +GetEnv("PROMPT"))>>
   \\<<iif(empty(GetEnv("USERDOMAIN")),            ',Chr(13)+chr(10)+"UserDomain="           +GetEnv("USERDOMAIN"))>>
   \\<<iif(empty(GetEnv("USERNAME")),              ',Chr(13)+chr(10)+"UserName="             +GetEnv("USERNAME"))>>
   \\<<iif(empty(GetEnv("USERPROFILE")),           ',Chr(13)+chr(10)+"UserProfile="          +GetEnv("USERPROFILE"))>>
   \\<<iif(empty(GetEnv("NUMBER_OF_PROCESSORS")),  ',Chr(13)+chr(10)+"NUMBER_OF_PROCESSORS=" +GetEnv("NUMBER_OF_PROCESSORS"))>>
   \\<<iif(empty(GetEnv("PROCESSOR_ARCHITECTURE")),',Chr(13)+chr(10)+"PROCESSOR_ARCHITECTURE="+GetEnv("PROCESSOR_ARCHITECTURE"))>>
   \\<<iif(empty(GetEnv("PROCESSOR_IDENTIFIER")),  ',Chr(13)+chr(10)+"PROCESSOR_IDENTIFIER=" +GetEnv("PROCESSOR_IDENTIFIER"))>>
   \\<<iif(empty(GetEnv("PROCESSOR_LEVEL")),       ',Chr(13)+chr(10)+"PROCESSOR_LEVEL="      +GetEnv("PROCESSOR_LEVEL"))>>
   \\<<iif(empty(GetEnv("PROCESSOR_REVISION")),    ',Chr(13)+chr(10)+"PROCESSOR_REVISION="   +GetEnv("PROCESSOR_REVISION"))>>
[li]Open Table Structures:
Code:
   \ Open Table Structures:
   lnDbfs = AUSED(laDbfs)
   for lnI = 1 to lnDbfs  && LASv10.00 wgcs
     && 7/24/03 wgcs: Fill in with all used tables.
     ep_USED = ep_USED+Tran(laDBFs[lnI,2])+':'+laDBFs[lnI,1]+' '
     *TTv10.00.5: Detail (filter()) added
     *7/24/03: changed to using AUSED() instead of always checking first 100 areas.
     \Work Area <<laDBFS[lnI,2]>>: "<<laDBFS[lnI,1]>>" DBF=<<DBF(laDBFS[lnI,2])>> Filter()=[<<ep_Filter>>]
     \  Structure: (
     lnFlds = AFields( laFlds, laDBFS[lnI,2] )
     for lnJ = 1 to lnFlds
       \\ <<laFlds[lnJ,1]>> <<laFlds[lnJ,2]>>(<<laFlds[lnJ,3]>>
       if laFlds[lnJ,2]='N'
         \\,<<laFlds[lnJ,4]>>
       endif
       \\)
     endfor
     \\ )
   endfor
[li]
[/ul]
[/ul]
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top