How do I get the application name and procedure name into the ABC error log?

Applies to: ABC ErrorClass; posted in the softvelocity.products.c55ee group; the thread names no build.

Problem

The original poster wanted each logged error message prefixed with customer, location, computer, application and procedure name, so messages sent to a helpdesk through DebugView show where they come from. He had copied and renamed the ErrorClass files (aberror.inc, aberror.clw, aberror.trn) and edited the Msg method. Referencing the template symbols %ApplicationName and %Procedure inside the class code did not work.

Solution

  1. Generated procedures call GlobalErrors.SetProcedureName('ProcName') at the start of Init and GlobalErrors.SetProcedureName (no parameter) at the end of Kill. The ErrorClass keeps that name.
  2. Inside the class code read it with SELF.GetProcedureName(). The call ErrorClass.GetProcedureName() gave the syntax error "Cannot use TYPEd structure in this way" inside the class, though it worked in a procedure's own code.
  3. Application name: COMMAND(0) returns the command string that started the program, which also shows the folder it was loaded from.
  4. Computer name: call the API GetComputerName(*CString,*ULong),SIGNED,RAW,PASCAL,NAME('GetComputerNameA').
  5. Customer and location: read them from the INI file with GETINI.

Caveats

  • The name is only right when the calling procedure sets it on the way in and out. Generated procedures do; for your own Source procedures add the calls yourself, else the log shows the last generated procedure that ran.
  • A poster advised that the name is only there for the programmer; at run time the program does not otherwise know the calling procedure.
  • A poster pointed to C55Util.clw for other system information (OS version, terminal server, network user name).
  • Renaming the log file and adding a TPS file without copying the aberror files was still open when the thread ended.

Today (2026)

Not re-tested. The method names are likely unchanged in the current ABC ErrorClass; check your build's aberror.inc.

Sources: the original poster (Nov 2002, the question), Bruce J. (Nov 2002), Maarten (Nov 2002), Todd W. (Nov 2002) in softvelocity.products.c55ee.