Skip to main content
117 votes
Accepted

Error while updating debug log trace flag

I have faced this issue, which I fixed it by deleting all debugs logs from developer console. In dev console, Select tab "Query Editor" at the bottom of the console Select check box "Use Tooling API"...
Pranay Jaiswal's user avatar
40 votes
Accepted

How do I see debug logs for Platform Event triggers in Salesforce?

From Christopher Marzilli via twitter: when you go into setup to create a new trace you should see an option for "Traced Entity Type" select Automated Process. It appears that Summer '17 ...
Daniel Ballinger's user avatar
32 votes
Accepted

How do I debug my lightning component?

General Tools and settings: use Chrome + built in Dev Tools + Lightning Component Inspector be sure debug mode is enabled in your org (Setup: Lightning Components) be sure caching is disabled in your ...
Christian Menzinger's user avatar
29 votes
Accepted

Avoid Proxy objects in debug statements for a Lightning component

This will get it out of proxy and back into nice, readable format. console.log(JSON.parse(JSON.stringify(myObject))); Used it so much I made a snippet of it (vscode, sublime, maybe others) "xlog": {...
Shane McLaughlin's user avatar
26 votes
Accepted

Debug logs not working for Site Guest Users (Force.com sites) after the Winter 17 release

The answer we received from Salesforce Tech support is that before the Winter 17 release, if you turned on debugging for a Site Guest User, you might receive an avalanche of debug logs if many ...
Jph108's user avatar
  • 651
21 votes
Accepted

System.debug() not displaying in debug logs

There are few things that you need to check. In your debug level check in Apex code debug is set Second check your debug log size if its 2MB <= then SF skip the Debug statement in that case set ...
Tushar Sharma's user avatar
21 votes
Accepted

How are we supposed to use debug logs for a specific Apex class only

Realistically, all you can do is set the user trace flags to a debug level with all levels set to "none", then set the class's log to a debug level that you want. Yes, you'll still be generating a ton ...
sfdcfox's user avatar
  • 497k
16 votes

Avoid Proxy objects in debug statements for a Lightning component

Here is how I generally work in chrome when i see a proxy object, Use the chrome "store as global variable" on the proxy object as shown in the below screenshot Then I just use the Javascript object....
Mohith Shrivastava's user avatar
16 votes
Accepted

Developer Console suddenly truncating System.Debug output

Sounds like they added something to the Dev console to truncate long lines in spring 19 (On March 20, 2019 according to the Release Note changes). Developer Console: String Values in Debug Logs Are ...
Daniel Ballinger's user avatar
14 votes

Console.log truncates my debug `...}`

The JSON.serialize(...) trick no longer works, if one needs un-truncated messages following wrapper class is what I use, I just paste it as helper method at bottom of the apex class in those ...
Daniel Sokolowski's user avatar
13 votes

How can I get a debug log for the sites guest user/public profile? [updated for Spring 18]

Adding to Shane's answer- The release notes which were linked to above include specific instructions for setting the cookie in Chrome, but not in Firefox. Here's one way of doing it in Firefox: ...
Martha Seneta's user avatar
13 votes

Error while updating debug log trace flag

The short term solution is to keep playing whack-a-mole~ApexLog as Pranay has suggested. Longer term, the problem comes back to the Summer'18 update Store Larger Debug Logs with Changed Log Limits: ...
Daniel Ballinger's user avatar
13 votes
Accepted

Different values from URL.getSalesforceBaseUrl().toExternalForm()

In Winter 19, we will have a new method, System.Url.getOrgDomainUrl(), which will always return the correct URL. Use the new System.Url.getOrgDomainUrl() method to interact with Salesforce REST and ...
sfdcfox's user avatar
  • 497k
12 votes

How can I get a debug log for the sites guest user/public profile? [updated for Spring 18]

Chrome & Edge The above answers are not so clear instructions for winter 17 release .For winter 17 release open the public site first by clicking on the links in the Develop | Sites | Site And ...
Mohith Shrivastava's user avatar
12 votes
Accepted

How to get running class and method names programmatically?

Here's a fun fact to get the ball rolling: the constructor for any Exception class will generate the current stack trace (no need to throw). So you can, for instance, get the stack trace in your ...
Adrian Larson's user avatar
  • 151k
11 votes

Console.log truncates my debug `...}`

If you are debugging large objects or lists, enclosing your debug contents with JSON.serializePretty(), eg: system.debug(JSON.serializePretty(hugeAccountList)); will insert line breaks, which allow ...
Aubry's user avatar
  • 309
10 votes
Accepted

Count of SOQL Statements used in Debug logs

It's the Limits class: Integer queriesUsed = Limits.getQueries();
Adrian Larson's user avatar
  • 151k
10 votes
Accepted

Debug Log Traced Entity Type Apex Class

You need to also set a TraceFlag on the user you want to trace. A TraceFlag set on a class only overrides the TraceFlag settings for the user; you use them together to get detailed analysis on a ...
sfdcfox's user avatar
  • 497k
10 votes
Accepted

is there a way to check a debug statement belongs to which class

Open the log in dev console and select Debug Only. Then select the columns File and Method In the above image, File corresponds to the Id of class which can be opened directly from url with /<--Id-...
salesforce-sas's user avatar
9 votes
Accepted

Why do debug logs not always work for a @future method?

The problem was -- I was executing anonymous code and checking the "Open Log" option. The call was actually generating two separate logs -- one for the anonymous code, and another for FutureHandler, ...
bertday's user avatar
  • 251
8 votes

Salesforce Developer Console - Getting a stack trace easily

If you go to set log panels and select "Execution Stack" and "Execution Log", it should bring up a stack trace panel next to the standard log panel. Clicking any line in the Log Panel will load up the ...
NSjonas's user avatar
  • 10.2k
8 votes

Salesforce Developer Console - Getting a stack trace easily

@NSjonas answer is good. I thought I'd add some more options. System.debug It's not ideal, as you need to modify the code to use it. Try something like: System.debug(LoggingLevel.Error, new ...
Daniel Ballinger's user avatar
8 votes

How are we supposed to use debug logs for a specific Apex class only

The short answer is, you can't. The class specific debug levels only control how verbose the logging for those classes are. When the user executes an action, all the classes within the same context ...
gNerb's user avatar
  • 9,508
8 votes

Does debug log level increase CPU time?

In addition to agreeing with Santranu's "yes", also bear in mind that the logging calls themselves consume CPU time as the argument string has to be built whether is is stored or not. We had logging ...
Keith C's user avatar
  • 136k
8 votes
Accepted

Where is the Lightning tab in the developer console?

Wrong Developer Console. While viewing the app or in LEX, press F12 to bring up the browser's Developer Console. It'll be far off on the right, you might need to click the >> arrow to see it.
sfdcfox's user avatar
  • 497k
8 votes
Accepted

What does Lightning Debug Mode do exactly?

The answer is: I misunderstood the docs plain and simply. Optimization and minification are performed on framework code only. Custom component code is NOT minified or obfuscated. https://developer....
Christian Szandor Knapp's user avatar
7 votes

Delete trace flags

From developer console, run this query- "select id from TraceFlag" Select the rows and your trace flags wil be deleted. Make Sure you check "Use Tooling API" before executing the query.
Abhinav Paul's user avatar
7 votes

How do I start to debug my own Apex code?

The mechanics of how to get debugging information have been covered effectively in the other answers. This is more of a 'how-to fish guide' to use your metaphor. You start with a symptom of the ...
Arpi Jakab's user avatar
7 votes
Accepted

The code block containing 'addError' is being executed but no error thrown during record save

The problem is this line here: objOpp = new Opportunity(id = mapOfOpportunity.get(eachKey)[0].Id); You're adding an error to a record that exists only in memory. Errors will only surface when you ...
sfdcfox's user avatar
  • 497k
7 votes
Accepted

Limitations of Apex Replay Debugger in VS Code

It can't simulate all variable states. To capture more info, use Checkpoints. See https://releasenotes.docs.salesforce.com/en-us/winter19/release-notes/rn_vscode_replay_debugger.htm
Bo Laurent's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible