No Results
Search Tips:
- Please consider misspellings
- Try different search keywords
Newer Version Available
TraceFlag
Represents a trace flag that triggers an Apex debug log at the specified logging level.
Supported SOAP API Calls
create(), delete(), describeSObjects(), query(), retrieve(), update(), upsert()
Supported REST API HTTP Methods
Query, GET, POST, PATCH, DELETE
Fields
| Field Name | Details |
|---|---|
| ApexCode |
|
| ApexProfiling |
|
| Callout |
|
| Database |
|
| ExpirationDate |
|
| ScopeId |
|
| System |
|
| TracedEntityId |
|
| Validation |
|
| Visualforce |
|
| Workflow |
|
Usage
To diagnose a functional issue or
a performance problem, use the TraceFlag object to set up logging
for yourself or for another user. The following options are available:
- To set up a log for a specific user, set ScopeId to null and TracedEntityId to the ID of the user. This option can only be configured for a user, not an Apex class or Apex trigger.
- To configure logging levels for system logs (visible only to you), set ScopeId to user and TracedEntityId to the ID of the logged-in user.
- To set up a system log (visible only to you) for a specific Apex class or trigger, set ScopeId to user and TracedEntityId to the ID of the Apex class or trigger.
The example below creates a new trace flag and attaches
it to an end user.
1//create a new TraceFlag object
2 TraceFlag traceFlag = new TraceFlag();
3 traceFlag.ApexCode = "Finest";
4 traceFlag.ApexProfiling = "Finest";
5 traceFlag.Callout = "Info";
6 traceFlag.Database = "Finest";
7 traceFlag.System = "Debug";
8 traceFlag.Validation = "Info";
9 traceFlag.Visualforce = "Info";
10 traceFlag.Workflow = "Info";
11
12 //set an expiration date
13 traceFlag.ExpirationDate = myTimestamp;
14 //set the ID of the user to monitor
15 traceFlag.TracedEntityId = "005A0000000i93O";
16
17 //call the create method
18 TraceFlag[] traceFlags = { traceFlag };
19 SaveResult[] traceResults = sforce.create(traceFlags);
20 for (int i = 0; i < traceResults.Length; i++)
21 {
22 if (traceResults[i].success)
23 {
24 Console.WriteLine("Successfully created trace flag: " +
25 traceResults[i].id);
26 }
27 else
28 {
29 Console.WriteLine("Error: could not create trace flag ");
30 Console.WriteLine(" The error reported was: " +
31 traceResults[i].errors[0].message + "\n");
32 }
33 }