113 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
39 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
31 votes

Apex debugging in Winter '16 - how well does it work?

Some points from the DF15 presentation that Nate linked to. You can only have 2 active debugger threads in an Org. You can't, currently, debug asynchronous code (some allowances for test contexts) It'...
Daniel Ballinger's user avatar
27 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
19 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
  • 481k
16 votes

Apex debugging in Winter '16 - how well does it work?

The answer I got from My Account Executive: The cost is 18,000 USD a year and it requires some internal approvals before it can be sold...
Yo Force's user avatar
  • 171
16 votes
Accepted

Apex debugging in Winter '16 - how well does it work?

I convinced my PM that I needed the debugger for my recent project. I have not really used it much however, as I ended up doing so much front end work. Also, with lots of unit tests, you don't need it ...
Caspar Harmer's user avatar
16 votes

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

[UPDATE 2022]: This is no longer true (for some time already), see other answers. This is a feature (although in this case you may not view it as such, understandably) of the built in toString on ...
ca_peterson's user avatar
  • 22.9k
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
15 votes

How do I start to debug my own Apex code?

I've added an Apex debugger to Illuminated Cloud that allows you to step through code, see variable values, etc. It uses information from debug logs and checkpoints to "replay" the executed process, ...
Scott Wells'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
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
  • 481k
12 votes

Apex debugging in Winter '16 - how well does it work?

Not an answer: But here's the DF15 presentation: https://www.youtube.com/watch?v=O2TvQ3rtpV0 As mentioned at 18:30 it's an add on product (for purchase).
Nathan Lipke's user avatar
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
  • 149k
12 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
10 votes
Accepted

Is there any way via any API to track Metadata history?

Starting with Winter'16 the SetupAuditTrail object has now been exposed via the Salesforce API's and within Apex via SOQL. Its pretty much a mirror of the CSV download, accept for the Delegate User (...
Andrew Fawcett's user avatar
10 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
  • 199
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
  • 149k
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
  • 481k
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, ...
serverpunk's user avatar
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

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
  • 135k
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
  • 481k

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