Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.


Debugging and Tuning

Produce a listing describing the executing environment for post-mortem debugging and tech-support by wgcs
Posted: 4 Dec 03

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.

  • In the main error log, I want:
    • program version:global variable value
    • program name: PROGRAM(0) ... sometimes these logs come in with no explanation, particularly with our automatic web-based error reporting
    • date and time: TTOC(DATETIME())
    • Call Stack (see below)
    • procedure throwing the error (sys(16) in ON ERROR parameter) and the line number (LINENO() in ON ERROR parameter)
    • error MESSAGE()
    • instruction causing the error..MESSAGE(1)
    • current drive and directory: SET('DEFA')+CURDIR()
    • currently selected ALIAS() and the DBF() behind it
    • 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).

  • Other things that are important:
    • Domain/computer Info:
      • getenv("USERDOMAIN")
      • getenv("COMPUTERNAME")
      • api: GetComputerName
      • api: NetServerGetInfo
      • api: GetHostName
      • sys(0)
      • api: IP Address: GetHostByName
      • api: InetAddr

    • Login Name
      • getenv("USERNAME")
      • api: GetUserName
      • api: WNetGetUser
      • sys(0)

    • OS
      • OS()
      • getenv("OS")
      • api: NetServerGetInfo
      • Sysinfo.ocx

    • CPU/Memory
      • getenv("PROCESSOR_IDENTIFIER")
      • api: GetSystemInfo
      • api: GlobalMemoryStatus
      • api: Diskspace( , 0) and Diskspace( , 1)
      • getenv("NUMBER_OF_PROCESSORS")
      • api: GetSystemInfo
      • Resolution: sysmetric(1) and sysmetric(2)

    • DLL/EXE File Version Info:
      • api:1. AGetFileVersion()

    • VFP Operating Environment:
      • Call Stack:

             ep_lev = 1
             \ Call Stack:
             do while !empty( program( ep_Lev ) )
               \   << Program( ep_Lev ) >>
               ep_Lev = ep_Lev+1

      • Environment Variables:
           \ 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_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"))>>

      • Open Table Structures:
           \ 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'
             \\ )

Back to Microsoft: Visual FoxPro FAQ Index
Back to Microsoft: Visual FoxPro Forum

My Archive


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close