19
votes
Accepted
System.debug(JSON.Serialize(o)) Not longer shows full string
Unfortunately, since Spring'19 in order to improve performance, Salesforce changed a way how long strings are shown in the Developers Console.
Now strings are now truncated at 512 characters in the ...
18
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 ...
17
votes
How to Delete All Debug Apex logs in Apex?
You cannot delete the debug logs natively in Apex code. But you can use Rest DELETE endpoint to delete debug logs.
I have created a utility code to delete debug logs that way, you can refer it.
The ...
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 ...
14
votes
Accepted
Maximum log level exceeded in Developer Console
The short term solution is to keep playing whack-a-mole~ApexLog as Adrian has suggested.
Longer term, the problem comes back to the Summer'18 update Store Larger Debug Logs with Changed Log Limits:
...
14
votes
Maximum log level exceeded in Developer Console
I believe I saw the fix to this on SFSE, but can't seem to find it now. When having this issue, run this query in your Query Editor:
SELECT Id FROM ApexLog
Then simply delete all rows.
13
votes
System.debug(JSON.Serialize(o)) Not longer shows full string
I always recommend using Checkpoints; this gives you an easy way to inspect the entire heap (memory). You can learn more about this in the trailhead Inspect Objects at Checkpoints. Simply open the ...
11
votes
Accepted
What is the purpose of Apex Class Trace flags?
Class and trigger trace flags override other logging levels, including logging levels set by user trace flags, but they don’t cause logging to occur.
As you quoted, simply setting a class trace flag ...
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 ...
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-...
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 ...
8
votes
Accepted
How to obtain trigger log from Email2Case?
The running user for Email to Case is found in Setup | Customize | Cases | Support Settings under the field Automated Case User if you are using On-Demand E2C
The user listed in the Case History ...
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 ...
7
votes
How to see anonymous code debug logs in visual studio code?
You can see the logs by
Opening the Command Palette and enter sfdx get in the search box
Then choose SFDX: Get Apex Debug Logs... After a few seconds, you are prompted to select a debug log to ...
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 ...
6
votes
How to Query ApexLog raw body?
You don't name a use case, or whether there is a particular place you are integrating this from. But if it was just a matter of, "I need to get a log out and check for some string value in it," these ...
6
votes
Accepted
Omit debug logging for specific Apex class
It is not possible to get debug logs with arbitrary logging levels to omit VARIABLE_ASSIGNMENT and other basic profiling information unless you move your code to a Managed Package.
6
votes
is there a way to check a debug statement belongs to which class
The line numbers do appear in the debug logs, e.g.
08:02:34:164 USER_DEBUG [375]|DEBUG|LINE ITEM COUNTER B:1
That "[375]" in the log is the line number that this particular system.debug(); ...
6
votes
Accepted
How to see anonymous code debug logs in visual studio code?
I would make sure you have an active User Trace Flag. I have noticed that in vscode sometimes you need to have your user trace flag set even when running anonymous apex.
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 ...
5
votes
Accepted
Enabling Debug Logs
You will need to automate the creation of the TraceFlag record for the user in question. This could be done either via Apex calling the Tooling API, or via an external process.
TraceFlag records are ...
5
votes
How to analyze Apex CPU consumption
I don't know if you're open to something commercial, but Illuminated Cloud's Log Analyzer has specialized views for profiling various resources including CPU time, heap, SOQL queries and DML, etc.
...
4
votes
Accepted
unable to get the debug log of a site guest user
You can do this by adding a browser cookie. See the release notes here
Salesforce does not debug the guest site user by default because they can generate a lot of debug logs.
4
votes
How to Delete All Debug Apex logs in Apex?
As far as I can tell, the documentation is mistaken in showing that ApexLog can be deleted from Apex DML.
The object is deletable from the Tooling API, however. You can tackle this in two ways:
You ...
4
votes
Accepted
How do I set the log levels for force:apex:log:tail?
You need to set the debug level on the DEVELOPER_LOG trace flag for your user. It is written in the documentation:
-d | --debuglevel DEBUGLEVEL
Optional
Debug level to set on the DEVELOPER_LOG trace ...
4
votes
Accepted
Who runs Email-to-Case
You can check the Support Setting and look for "Automated Case user" that user is used for Email-to-Case
4
votes
Is it possible to know WHY SOQL retrieves EMPTY?
If the apex class is running in with sharing context then the record level access will kick in the SOQL queries, where it will check if record is shared to the running user or not.
Record Access gets ...
3
votes
Accepted
Custom visualforce component inside Visualforce Email Template: How to see apex debug messages?
Since the email sending is part of post-commit logic I suppose the rendering of the email and running the visualforce component logic happens after the debug log is already saved. Therefore it is ...
3
votes
Accepted
How to Query ApexLog raw body?
It's in ApexLog, but you can't query/filter the log itself, only the exposed metadata (e.g. status or request). You would necessarily need to download each one using the preferred API (/sobjects/...
3
votes
How to exclude logging by class in Summer 17 and later
Unfortunately that is the primary logging telling you about the transition into the class specific logging levels and back via the PUSH_TRACE_FLAGS and POP_TRACE_FLAGS events.
Say you call from the ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
debug-logs × 133apex × 49
debugging × 31
debug × 17
developer-console × 16
salesforcedx × 11
trigger × 8
visual-workflow × 7
managed-package × 6
vs-code × 6
apex-debugger × 6
soql × 5
visualforce × 4
lightning × 4
lightning-web-components × 4
batch × 4
salesforcedx-cli × 4
logging × 4
unit-test × 3
community × 3
rest-api × 3
visualforce-component × 3
error × 3
subscriber × 3
cpulimit × 3