Hot answers tagged

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
53 votes

Delete all in Debug log

Now that we have SFDX, I use the below method to delete debug logs from terminal: $ sfdx force:data:soql:query -t -q "SELECT Id FROM ApexLog" -r "csv" > out.csv $ sfdx force:...
javanoob's user avatar
  • 8,787
34 votes
Accepted

Delete all in Debug log

SELECt ID from APEXLOG and run this query in DC Query Editior and select the tooling API checkbox. Now Delete all the records. It will solve your problem and this is a native solution.
Tushar Sharma'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
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
17 votes
Accepted

DateTime.format() unexpected behavior

Actually... the datetime format is right. The capital Y merge field is the WEEK YEAR - which from the 27th December 2015 is IN 2016! The lower case y merge field is the CALENDAR YEAR - which will be ...
Simon Lawrence's user avatar
15 votes
Accepted

Salesforce doesn't show debug logs

have seen this behavior many times in multiple orgs (logs do exist in the dev console though). Just waiting for SF to figure it out and fix it. Since one cannot report anything without being directed ...
Eric's user avatar
  • 54k
14 votes

Delete all in Debug log

I had an org with over 400mb of logs that needed to be cleared! The Salesforce developer tools only lets you delete 2000 rows at a time and the process has to be manually repeated. So instead I ...
Daniel Sokolowski's user avatar
14 votes

Salesforce doesn't show debug logs

Just in case it is helpful, you can also directly query for the Debug logs yourself using ApexLog. It's accessible in both the Partner API and the Tooling API. You would typically filter the ApexLog ...
Daniel Ballinger's user avatar
13 votes
Accepted

Is it possible to get current line number in Apex?

Put the following function in some class somewhere: public static Integer currentLineNumber() { try { Integer x = 0 / 0; } catch(Exception e) { String line2 = e....
sfdcfox's user avatar
  • 481k
12 votes

Delete all in Debug log

Use apex debugger chrome extensions. There you can select debug size. for example select 5000 and delete all the debugs. Great tool Chrome extensions Apex Debugger Salesforce Coding Utility
Ratan Paul's user avatar
  • 22.5k
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
11 votes

How to print ALL the elements of a List<>?

You could use JSON serialization to format all the records in the collection. E.g. List<Account> accs = new List<Account>(); for(integer i = 0; i < 50; i++) { accs.add(new ...
Daniel Ballinger's user avatar
11 votes
Accepted

Adding a System.debug changes code behavior

Which is a bit unexpected for me as Accounts with different fields should result in a different hash. I know that using sObjects for map keys is bad practice but still interested in how adding a debug ...
sfdcfox's user avatar
  • 481k
10 votes
Accepted

Is it a good practice to set debug points in possible failure points in our Apex code?

Setting just system.debug won't help you much since in orgs where your package is installed might have lot of other codes that might lead to logs truncation and your debug statements getting lost. ...
Mohith Shrivastava's user avatar
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
9 votes
Accepted

MAXIMUM DEBUG LOG SIZE REACHED

Generally speaking, you can control the logging level using the TraceFlags. TraceFlags have overriding authority over all other tracing methods. See Summer '15 Release notes - Receive Debug Logs ...
Daniel Ballinger's user avatar
8 votes

What is the Log level to see apex debug statements?

The minimum value to see any debug logs is a System level of ERROR, but most people only use the default logging level, so the usual recommendation is DEBUG. To debug at a lower level than debug, use ...
sfdcfox's user avatar
  • 481k
8 votes
Accepted

Debug log is filled with USER_INFO

Ok, I had the same error, and after much digging, may have a solution. In the debug log area, delete all logging levels and all traces. Then in the dev console, do this query (using the tooling API):...
Caspar Harmer's user avatar
8 votes
Accepted

Writing too much to debug log increases heap and cpu time

Yes, this is expected, and perfectly normal. Each time you call System.debug, the object you pass in must serialized, even if the system eventually doesn't end up putting anything in to the log, and ...
sfdcfox's user avatar
  • 481k
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
7 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,441
7 votes
Accepted

Mass delete Debug logs using Salesforce DX

The following worked for me sfdx force:data:soql:query -q "SELECT Id FROM ApexLog" -r "csv" | out-file -encoding oem out.csv sfdx force:data:bulk:delete -s ApexLog -f out.csv With ...
Pmanglani's user avatar
  • 158
7 votes
Accepted

Is there a way to create Trace Flags for certain user using SFDX?

Yes, you can create a Trace Flag via command line. The command for creating a new Trace Flag: sfdx force:data:record:create --sobjecttype TraceFlag -v "StartDate=$NOW ExpirationDate=$EXP ...
Freddy's user avatar
  • 203
6 votes

Delete all in Debug log

I used the dataloader to export and delete all the debug logs. There were over 4K records so this was without a doubt the quickest way to do it. I chose the object ApexLog and used the following query:...
Jean Grey's user avatar
6 votes
Accepted

What is the 'INTERNAL' debug level?

I have been informed by technical support that R&D has investigated the issue, and that this value will be removed from the UI at some point. As such, we shouldn't use this value for debugging.
6 votes
Accepted

What is Debug level in new Salesforce Edition?

The debug log got a new name(i think) as Trace Flag. Few Points to note: The trace flag can be set to any User, Apex Class or Apex Trigger. The trace flag can be set to a specific time interval ...
Vigneshwaran G's user avatar
6 votes
Accepted

Debug logs in developer console?

In the Developer Console, uncheck "Show My Current Logs Only".
Daniel Ballinger's user avatar
6 votes

Mass delete Debug logs using Salesforce DX

The following worked fine for me in MAC sfdx force:data:soql:query -q "SELECT Id FROM ApexLog" --resultformat csv > out.csv sfdx force:data:bulk:delete -s ApexLog -f out.csv I have not ...
Mohith Shrivastava's user avatar
6 votes
Accepted

LWC - Debugging using devtools

There's a good blog post on debugging your LWC components that the below info is all taken from. I'll include the video walkthrough which is easy to follow along with and only 7 minutes long. In ...
Kris Goncalves's user avatar

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