Apex Unexpected Exception Event Type

The Apex Unexpected Exception event type captures information about unexpected exceptions in Apex code execution. This event type is available in the EventLogFile object in API version 45.0 and later. Unexpected exception information is not captured in the EventLogFile object with @IsTest and anonymous Apex.

For details about event monitoring, see the Trailhead Event Monitoring module or REST API Developer’s Guide.

Fields

Field Details
EVENT_TYPE
Type
String
Description
The type of event. The value is always ApexUnexpectedException.
EXCEPTION_CATEGORY
Type
String
Description
The category of the unexpected Apex exception. Provides a breakdown of unhandled exceptions based on the type. For example, the LimitException exception type is split into subcategories that indicate if you exceeded a limit, such as the total heap size or CPU time.
Possible values:
  • Subcategories of LimitException that indicate the Apex limit you’ve exceeded. Examples:
    • LimitException: CpuTime: Maximum CPU time on the Salesforce servers.
    • LimitException: HeapSize: Total heap size.
    • LimitException: Queries: Total number of SOQL queries issued.
    • LimitException: QueryRows: Total number of records retrieved by SOQL queries.
    • LimitException: DmlStatements: Total number of DML statements issued.
    • LimitException: Callouts: Total number of callouts (HTTP requests or web services calls) in a transaction.

    See Execution Governors and Limits for other limits.

  • CustomException: Unhandled custom exception.
  • An Apex exception that isn’t limit-related; see Exception Class and Built-In Exceptions
This field is available in API version 57.0 and later.
Example
LimitException: CpuTime
EXCEPTION_MESSAGE
Type
Text
Description
The exception’s message.
Example
Divide by 0
EXCEPTION_TYPE
Type
String
Description
The class type of the unexpected exception.
Example
System.MathException
ORGANIZATION_ID
Type
Id
Description
The 15-character ID of the org.
For example: 00D000000000123.
REQUEST_ID
Type
String
Description
The unique ID of a single transaction. A transaction can contain one or more events. Each event in a given transaction has the same REQUEST_ID.
For example: 3nWgxWbDKWWDIk0FKfF5DV.
STACK_TRACE
Type
Text
Description
The stack trace for the exception.

If the exception is thrown from a managed package, STACK_TRACE is omitted.

Note

Example
Class.OpportunityUtility.insert: line 22, column 1
AnonymousBlock: line 1, column 1
TIMESTAMP
Type
String
Description
The access time of Salesforce services in GMT.
For example: 2024-08-08T06:08:02.755+0000.
TIMESTAMP_DERIVED
Type
DateTime
Description
The access time of Salesforce services in ISO8601-compatible format (YYYY-MM-DDTHH:MM:SS.sssZ).
For example: 2015-07-27T11:32:59.555Z. Timezone is GMT.
USER_ID
Type
Id
Description
The 15-character ID of the user who’s using Salesforce services through the UI or the API. For example: 00530000009M943.
USER_ID_DERIVED
Type
Id
Description
The 18-character case-insensitive ID of the user who’s using Salesforce services through the UI or the API.
For example: 00590000000I1SNIA0.