Jump to content

LogFormatEntry

From EDM2

LogFormatEntry formats a Log Entry for display.

Syntax

LogFormatEntry(service, pFormatEntry)

Parameters

service (ULONG) - input
The class of Logging Service:
  • Error logging
  • All other values are reserved for future use.
pFormatEntry (PVOID) - input
A pointer to the LogFormatEntry parameter packet.
  • For Error Logging, this is a pointer to a LFEREQUEST structure.

Returns

rc (APIRET) - returns
Return code.
LogFormatEntry returns the following values:
  • 0 No error
  • 2 Error file not found
  • 520 Error LF buf too small
  • 523 Error LF invalid service
  • 524 Error LF general failure
  • 1703 Invalid data pointer
  • 1701 Invalid LF log file id
  • 1702 Invalid LF packet revision number
  • 1706 Invalid LF parm packet ptr
  • 1751 Invalid LF flag
  • 1761 Error LF invalid packet size
  • 1770 Invalid log entry record
  • 1771 No log entry format template available
  • 2507 RAS unicode conversion error
  • 2600 RAS invalid locale object

Remarks

ADDITIONAL RETURNS INFORMATION

The data will be passed back in multiple occurrences of the following LTD (Length, Type, Data) format:

ULONG
    length ULONG
    type UniChar
    data[n] or
Char
    data[n] 

Where:

  • length (ULONG) is the length, in bytes, of this detail record (includes length, type, and data fields).
  • type (ULONG) is an integer value that represents the type of data being passed back.

An error record is created by the system when an error in a system or application program triggers a probe in that program. Error records contain detailed information to help you diagnose the error. Error records are also called DET1 records. Records created by a back level logging system are called DET4 records.

A control record is created by the system when you make changes to the way errors are logged. For example, when you suspend error logging or direct error logging to a new file, the system records that change in a control record. Control records are also called DET2 records. Control records are new for FFST technology and are not available in records created by a back level logging system.

The following are the current Error Logging type values and their meanings:

Type Meaning From Record Type
0005 Date heading DET1, DET2, or DET4 record
0006 Date DET1, DET2, or DET4 record
0007 Time heading DET1, DET2, or DET4 record
0008 Time DET1, DET2, or DET4 record
0009 Entry ID heading DET1, DET2, or DET4 record
0010 Entry ID DET1, DET2, or DET4 record
0011 Severity heading DET1 record
0012 Severity DET1 record
0013 Module name heading DET1 record
0014 Module name DET1 record
0015 Directory name heading DET1 record
0016 Directory name DET1 record
0017 Error message heading DET1 record
0018 Error message text DET1 record
0019 Probe ID heading DET1 record
0020 Probe ID text DET1 record
0021 Probe Flags heading DET1 record
0022 Probe Flags DET1 record
0023 Template Repository pathname heading DET1 record
0024 Template Repository pathname text DET1 record
0025 Template ID heading DET1 record
0026 Template ID text DET1 record
0027 Dump generated heading DET1 record
0028 Dump Generated text DET1 record
0029 Trace file generated heading DET1 record
0030 Trace File generated text DET1 record
0031 Process dump generated heading DET1 record
0032 Process Dump generated text DET1 record
0040 Failure Causes heading DET1 record
0041 Failure Cause (Could be 4 of these) DET1 record
0050 Failure Actions heading DET1 record
0051 Failure Action (Could be 4 of these) DET1 record
0060 Install Causes heading DET1 record
0061 Install Cause (Could be 4 of these) DET1 record
0070 Install Actions heading DET1 record
0071 Install Action (Could be 4 of these) DET1 record
0080 User Causes heading DET1 record
0081 User Cause (Could be 4 of these) DET1 record
0090 User Actions heading DET1 record
0091 User Action (Could be 4 of these) DET1 record
0100 Return Code heading DET1 record
0101 Return Code text DET1 record
0110 Dump File name heading DET1 record
0111 Dump File name text DET1 record
0112 Dump formatter heading DET1 record
0113 Dump Formatter text DET1 record
0114 Dump File Deletion Date heading DET1 record
0115 Dump File Deletion Date DET1 record
0116 Dump File Deletion Time heading DET1 record
0117 Dump File Deletion Time DET1 record
0120 Trace File name heading DET1 record
0121 Trace File name text DET1 record
0122 Trace formatter heading DET1 record
0123 Trace formatter text DET1 record
0124 Trace File Deletion Date heading DET1 record
0125 Trace File Deletion Date DET1 record
0126 Trace File Deletion Time heading DET1 record
0127 Trace File Deletion Time DET1 record
0130 Process Dump File name heading DET1 record
0131 Process Dump File name text DET1 record
0132 Process Dump formatter heading DET1 record
0133 Process Dump formatter text DET1 record
0134 Process Dump Deletion heading Date DET1 record
0135 Process Dump File Deletion Date DET1 record
0136 Process Dump Deletion Time heading DET1 record
0137 Process Dump File Deletion Time DET1 record
0140 PCT heading DET1 record
0141 PCT Execution Parameters DET1 record
0150 DMI vendor tag heading DET1 record
0151 DMI vendor tag text DET1 record
0155 DMI tag heading DET1 record
0156 DMI tag text DET1 record
0165 DMI product ID heading DET1 record
0166 DMI product ID text DET1 record
0170 DMI revision heading DET1 record
0171 DMI revision text DET1 record
0172 DMI modification level heading DET1 record
0173 DMI modification level text DET1 record
0174 DMI fix level heading DET1 record
0175 DMI fix level text DET1 record
0195 Machine type heading DET1 record
0196 Machine type text DET1 record
0200 Machine serial number heading DET1 record
0201 Machine serial number text DET1 record
0205 Hostname heading DET1 record
0206 Hostname text DET1 record
0210 User Data heading DET1 record
0211 User data text DET1 record
0213 Action heading DET2 record
0214 Action text DET2 record
0215 Old Value heading DET2 record
0216 Old Value text DET2 record
0220 New Value heading DET2 record
0221 New Value text DET2 record
0222 Created by backlevel text DET4 record
0223 Record ID heading DET4 record
0224 Record ID DET4 record
0225 Qualifier heading DET4 record
0226 Qualifier DET4 record
0227 Originator heading DET4 record
0228 Originator DET4 record
0229 User data DET4 record
0230 Process name heading DET4 record
0231 Process name DET4 record
0232 FMTDLL heading DET4 record
0233 FMTDLL name DET4 record
0234 FMTDLL text DET4 record
0235 GA component ID heading DET4 record
0236 GA component ID DET4 record
0237 GA release level heading DET4 record
0238 GA release level DET4 record
0239 GA software name heading DET4 record
0240 GA software name DET4 record
0241 Generic alert subvector heading DET4 record
0242 Generic alert subvector text DET4 record
0243 Probable causes subvector heading DET4 record
0244 Probable causes subvector text DET4 record
0245 User causes subvector heading DET4 record
0246 Install causes subvector heading DET4 record
0247 Failure causes subvector heading DET4 record
0248 Subvector key heading DET4 record
0249 Subvector key type DET4 record
0250 Subvector key text DET4 record
0251 Hex dump text DET4 record

data (UniChar[]) or data (Char[]) is a variable length area that contains the formatted data.

Note: If there is no data, only the length and type portion of the record will be returned. The length would indicate that there is no data.

The library LFAPI.LIB must be linked with object files that use LogFormatEntry

The packet_revision_number parameter defines if pointers point to ASCII or UniCode character data.

Example Code

#define INCL_LOGGING
#include <os2.h>
#include <lfdef.h>

ULONG     service;
PVOID     pFormatEntry;
APIRET    rc;

rc = LogFormatEntry(service, pFormatEntry);

The following example formats an Error Log record for display. The calling program has placed the address of the locale object in locale.

  #define INCL_LOGGING
  #include <unidef.h>
  #include <os2.h>
  #include <stdio.h>
  #include <lfdef.h>

  {
  APIRET rc;                              /* return code */
  ULONG service;
  LFEREQUEST format_entry_packet;
  BYTE log_entry_buffer[1024];
  UniChar string_buffer[4096];
  #define STRING_BUFFER_LENGTH 4096
  ULONG string_buffer_length;
  LocaleObject locale;

  service = ERROR_LOGGING_SERVICE;
  string_buffer_length = STRING_BUFFER_LENGTH;
  rc = UniCreateLocaleObject(UNLUCS_STRING_POINTNER,(UniChar *) L"",&locale);
  if (rc |= 0)
    {
     printf("UniCreateLocaleObject error: return code = %d",rc);
     return;
    }

  /* Construct the Error Log Service format packet  */
  format_entry.packet.packet_size = sizeof(LFEREQUEST);
  format_entry_packet.packet_revision_number = WPOS_RELEASE_1;
  format_entry_packet.log_entry_buffer =  &log_entry_buffer;
  format_entry_packet.flags = ERR_FORMAT_DETAIL_DATA;
  format_entry_packet.locale_object = locale;
  format_entry_packet.string_buffer_length = &string_buffer_length;
  format_entry_packet.string_buffer =  &string_buffer;
  rc = LogFormatEntry(service,            /* service */
              &format_entry_packet)   /* parameter packet */
  if (rc |= 0)
    {
     printf("LogFormatEntry error: return code = %d",rc);
     return;
    }

Related