SlideShare a Scribd company logo
1 of 34
Become a Debug Log Surgeon
Taking Your Dev Console Troubleshooting Skills to the Next Level
jess.lopez@salesforce.com, @jjjlo
Jess Lopez, NGO Technical Architect, Salesforce.org Customer Centric Engineering
Forward-Looking Statements
Statement Under the Private Securities Litigation Reform Act of 1995
This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties
materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. or Salesforce.org could differ materially from
the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could
be deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other
financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any
statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services.
The risks and uncertainties referred to above include – but are not limited to – risks associated with Salesforce.org or as applicable
Salesforce (referred to collectively as “we” and “our”) developing and delivering new functionality for our service, new products and
services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth,
interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed
and any possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to
expand, retain, and motivate our employees and manage our growth, new releases of our services and successful customer deployment,
our limited history reselling non-salesforce.com products, and utilization and selling to different market segments. Further information on
potential factors that could affect the financial results of salesforce.com, inc. is included in its annual report on Form 10-K for the most
recent fiscal year and in its quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and others containing
important disclosures are available on the SEC Filings section of the Investor Information section of the Salesforce Web site.
Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently
available and may not be delivered on time or at all. Customers who purchase salesforce.com services or the Salesforce.com-developed
products and services should make the purchase decisions based upon features that are currently available. Salesforce.org assumes no
obligation and does not intend to update these forward-looking statements.
Step 1
Step 5
Step 4
Step 3
Step 2
NPSP /
Managed
Packages
Where might
we find errors?
Order of
Execution &
Governor
Limits
Real World
Example
Common Errors
and Strategies
for
Troubleshooting
Step 6
Agenda
The Dev
Console
Who am I?
I went to college thinking I would become a surgeon.
Who am I?
I went to college thinking I would become a surgeon.
Who am I?
Today, I’m a Salesforce.org NGO Architect in Customer Centric Engineering.
Who am I? It’s similar… kind of.
Help! NPSP is doing this really strange thing
for a customer and it’s causing them some
major pain and headaches.
Find and resolve the issue quickly!
“
”
“Surgery” “Charts” “Grand Rounds”
It’s similar… kind of.
● Capture logs and
analyze with precision
● Review NPSP
codebase
● Resolve issue;
suggest resolution to
customer; or escalate
to Product team
● Case Escalations
● Investigations
● Github Issue
“Novels”
● Case Studies
● Trainings/
Bootcamps
“Diagnose
Critical Issues”
● Run “tests” and
analyze holistically.
● Determine root
cause
NPSP & Packages
NPSP at a Glance
NPSP = Nonprofit Success Pack
Salesforce.org Product; foundation of Nonprofit Cloud
Pre-built constituent and donor management components
Built on Salesforce.com
Flexible, open data architecture
Maybe...
Core
Salesforce.com (EE or UE)
Sales Cloud | Service Cloud
SFDO
Nonprofit Success Pack Volunteers for Salesforce
Usually...
Core
SFDO
Declarative and Programmatic Customizations
Managed PackageManaged PackageManaged PackageManaged PackageManaged Package
Salesforce.com (EE or UE)
Sales Cloud | Service Cloud
Nonprofit Success Pack Volunteers for Salesforce
Marketing Cloud Communities
Understanding Packages
Unmanaged
● Editable components
● Can’t be upgraded or changed by package owner
once installed
● Can see everything about the package in debug logs
Managed
● Some components are editable; others are not.
● Fully upgradeable
● Push updates
● Can’t see many things about the package in debug
logs
Certified Managed Packages:
● On AppExchange
● Have gone through Security Review
● Get own set of limits for most per-transaction limits
(DML, Query Limits, etc.)
“A package is a container for something as small as an individual component or as large as a set of
related apps. After creating a package, you can distribute it to other Salesforce users and
organizations, including those outside your company.”
Where might we find errors?
Record-Level Errors
Email / Chatter Notifications
NPSP Settings →
System Tools → Error
Notifications
● Choose to send to
specific User, System
Admins, or Chatter group
● Typically related to our
Scheduled Jobs
Apex Jobs
Errors Custom Object
View and clear logs within NPSP
Settings → System Tools → Error
Logs
Create reports on object, too!
Order of Execution
(Super High-Level)
Validation
Before Triggers
Duplicate Rules
Save, but don’t commit
After Triggers
Assignment Rules
Auto-Response Rules
Workflow Rules
Processes / Flows
Escalation Rules
Entitlement Rules
Roll-up Summaries (parents/grandparents)
Criteria-based Sharing Rules
Commit record
Post-commit logic
Governor Limits
Limits, Allocations, and Limitations
Allocations
Edition-based
constraints
(e.g. # of Custom
Objects, # of Validation
Rules)
Limits
Concrete numeric values
assigned to
features/functionality
(e.g. Max # of Sharing
Rules)
Limitations
Expected but unavailable
functionality
(e.g. Importing
Documents in the Data
Import Wizard)
Design-Time Limits
Cross-Object Formulas
Lots of vLookup Rules per object
Picklists with lots of values
Lots of Report Filters
Sharing Rules Limits
Criteria-Based Sharing Rules
Max Child Relationships
Run-Time Limits
Total # of SOQL Queries Issued
Total # of records retrieved by a SOQL Query
Total # of DML Statements Issued
Total Heap Size
Maximum CPU Time Limit
Maximum Transaction Execution Time
Shared across everything in the transaction
Certified managed packages have their own set
Synchronous vs. Asynchronous
Double or More!
Source: Execution Governors and Limits
Synchronous Asynchronous
Total # of SOQL Queries 100 200
Total Heap Size 6MB 12MB
Max CPU Time 10,000 ms 60,000 ms
Max Async Apex Method
Executions
250,000 (or # of licenses x 200)
Max # of Batch jobs
queued/active concurrently
5
Max # of Records Returned
for Batch Apex query in
QueryLocator
50,000,000
Real World Scenario
Let’s break it down.
Record-Level Error
Creating an Opportunity
”NPSP”…
“TDTM_Opportunity…”
“Sounds like an issue
with NPSP… right?!
Or is it…”
Enter the Debug Log
View exactly what’s happening
Debug Logs capture database operations, system processes, and errors
• View info on both declarative and programmatic customizations
Debug Levels
Crank it up or Dial it down
● Default =
SFDC_DevConsole
● Segmented categories
Creating New Trace Flag for a User
● Setup → Debug Logs: Manually
set debug logging for User,
Automated Process, Apex Class,
or Apex Trigger
● Or if Dev Console open, will
automatically capture.
View the Debug Log
Create an Opportunity again and view the log in Setup --> Debug Logs
What’s in a Log Entry?
14:49:59.037 (37045000)|USER_DEBUG|[2]|DEBUG|Hello World!
15:51:01.071 (55856000)|DML_BEGIN|[5]|Op:Insert|Type:Invoice_Statement__c|Rows:1
Debug Log Limits
Each Debug Log = 5 MB before truncation
Retention: System = 1 day; Monitored = 7 days
Total = 250MB in a 15 minute window
Debug Log Limits
Each Debug Log = 5 MB before truncation
Retention: System = 1 day; Monitored = 7 days
Total = 250MB in a 15 minute window
Enter the Dev Console
It’s not just for code.
View Logs
Create, view, and edit code
Execute Anonymous
Set/View Checkpoints in code
Query Editor
Query Plan
(Help Menu → Preferences → Enable Query Plan = true)
Let’s get a better view in the Dev Console
If not already open, go to Debug → uncheck Show My Current Logs Only
Still not great...
So much text.
NPSP is a managed
package, so you won’t
see some information.
You will still see query
information, general
execution times, etc.
What if we just switch our perspective?
Predefined layouts of panels
Dev Console Perspectives
Default View is Log
Only
Switch to All,
Analysis, or Debug
for different views
Save and create
your own
“All” Perspective
Stack Tree
Useful for digging into long-running operations
Execution Tree: each item
Performance: aggregate
Execution Log
Useful for troubleshooting execution times and to see how many records are being returned in
each query
Clicking on Query in Stack Tree, for instance, jumps to line in Execution Log
Execution Overview
Graphical View of Executed Units
“Stairway to Heaven”
Execution Overview
Executed Units – with filtering! (Filter to Queries since this is related to Query Limits)
This query might be the issue, since the Count is 100
Execution Log
Final Limits
(default)
- your limits
NPSP’s limits
- has own limits as a
certified managed package
Execution Log
Let’s back up a few lines
It wasn’t NPSP after all.
It was custom code in
RogueOpportunityHandler’s
queryPayments() method.
Because NPSP’s Opportunity
trigger kicked it off, it surfaced the
error.
Common Errors & Strategies
for Troubleshooting
Too many query rows: 50001
Can’t query for more than 50,000 records at a time ****
Dev Console Strategy
• Execution Overview → Executed Units tab. Filter
to only show Queries. Sort by Row columns
(Descending)
NPSP Scenario:
• Legacy Rollups, Error Notifier
General Strategies
• Avoid data skew; distribute / archive
• Add LIMIT to query
• Add more filters
• If related to a batch job, lower the batch size
Too many dml rows: 10001
Can’t insert, update, upsert, delete, undelete, merge more than 10K records at once
Dev Console Strategy
• Execution Overview → Executed Units tab. Filter
to only show DML. Sort by Row columns
(Descending)
NPSP Scenario:
• Recurring Donation => Opportunity Distribution
General Strategies
• Avoid data skew; distribute / archive
• Consider batching
• If related to a batch job, lower the batch size
• NPSP: Lower your Opportunity Forecast Month
Settings or your Batch Size Settings in NPSP
Settings
Apex CPU Timeout
Your execution took too long.
Typically, there’s a lot of automation occurring.
• Lots of triggers
• Lots of packages
• Lots of process builder processes, workflow
rules, flows, validation rules
• Recursion
NPSP Scenario:
• Contact Insertion
• Closed/Won Opportunity Insertion
Strategies
• Lower batch sizes
• Consider ways to optimize code / queries through
best practices and platform options
• This is a shared limit -- so consider ALL that’s
happening for a single transaction.
Too many query locator rows: 50000001
Batch Job start() method returned more than 50 million records
NPSP Scenario
• Opportunity Naming Batch Job
• Customizable Rollups Batch Jobs **
Strategies
• Add Limits / filters if applicable
• Consider batch chunking / chaining
• Data Archival
REQUEST_RUNNING_TOO_LONG
Usually the batch job’s start() query has timed out
NPSP Scenario
• Customizable Rollups Batch Jobs **
• Seasonal Address Batch Job **
Strategies
• Make sure query is selective (use Query Plan
tool)
• Consider custom indexes, but code should be
optimized first. There are also thresholds at play.
Skinny Tables, too.
• Reduce data with filters
• Consider batch chunking/chaining
Resources
Platform Resources
Salesforce Help
• Logs Tab
• Log Inspector
• Debug Logs
• Debug Log Levels **
• Debug Log Details
• Examples of Using the Log Inspector
• Debug Log Order of Precedence
• Debug Log (Apex Developer Guide)
Trailhead
• Dev Console Basics
• Write Efficient Queries
• Build Efficient Applications without Limits Trail
• Large Data Volumes
• Strategies for Big Data Architecture
• Find and Fix Bugs with Apex Replay Debugger
NPSP Resources
General
• Github “Cumulus” Repository and Issues
• General Product Documentation
• Power of Us Hub Groups and Topics
Trailhead
• Administer NPSP Trail
• Fundraise with Nonprofit Cloud Trail
QUIZ!
In Spring ‘19, what is the maximum size
of a debug log (in megabytes)?
5 megabytes
True or False:
You can view all code from
a managed package in a debug log.
False
How do you capture the logs for
a Scheduled Apex Job that starts
running at 4 a.m.?
1. Setup → Debug Logs
2. Create Trace Flag for running user of
Scheduled Job
3. Set the Start Time to 4 a.m.
What can you do if your logs are truncated?
(A) Wait until the Summer ‘19 release to start troubleshooting
(B) Delete your previous debug logs
(C) Reduce one or more Category logging levels for your Debug Level
(D) Download the debug log and view it in VS Code
What can you do if your logs are truncated?
(A) Wait until the Summer ‘19 release to start troubleshooting
(B) Delete your previous debug logs
(C) Reduce one or more Category logging levels for your Debug Level
(D) Download the debug log and view it in VS Code
True or False:
Flows count toward SOQL Query Limits
True.
Record Update, Record Delete, Record Lookup,
and Fast Lookup count.
Debug Log Surgeon

More Related Content

What's hot

санах ой
санах ойсанах ой
санах ойshulam
 
Тема 5. Агрегатне планування реалізації операційних стратегій
Тема 5. Агрегатне планування реалізації операційних стратегій  Тема 5. Агрегатне планування реалізації операційних стратегій
Тема 5. Агрегатне планування реалізації операційних стратегій Victor Step
 
Bin blocking solution EWM
Bin blocking solution EWMBin blocking solution EWM
Bin blocking solution EWMavinashnitjsr
 
Тема 14. Управління операційною інфраструктурою підприємства
Тема 14. Управління операційною інфраструктурою підприємстваТема 14. Управління операційною інфраструктурою підприємства
Тема 14. Управління операційною інфраструктурою підприємстваVictor Step
 

What's hot (8)

Dropbox гэж юу вэ
Dropbox гэж юу вэDropbox гэж юу вэ
Dropbox гэж юу вэ
 
санах ой
санах ойсанах ой
санах ой
 
Powerpoint test
Powerpoint testPowerpoint test
Powerpoint test
 
Cs101 lec6
Cs101 lec6Cs101 lec6
Cs101 lec6
 
Тема 5. Агрегатне планування реалізації операційних стратегій
Тема 5. Агрегатне планування реалізації операційних стратегій  Тема 5. Агрегатне планування реалізації операційних стратегій
Тема 5. Агрегатне планування реалізації операційних стратегій
 
Bin blocking solution EWM
Bin blocking solution EWMBin blocking solution EWM
Bin blocking solution EWM
 
Тема 14. Управління операційною інфраструктурою підприємства
Тема 14. Управління операційною інфраструктурою підприємстваТема 14. Управління операційною інфраструктурою підприємства
Тема 14. Управління операційною інфраструктурою підприємства
 
Health info
Health infoHealth info
Health info
 

Similar to Debug Log Surgeon

Manage Salesforce Like a Pro with Governance
Manage Salesforce Like a Pro with GovernanceManage Salesforce Like a Pro with Governance
Manage Salesforce Like a Pro with GovernanceSalesforce Admins
 
Manage Development in Your Org with Salesforce Governance Framework
Manage Development in Your Org with Salesforce Governance FrameworkManage Development in Your Org with Salesforce Governance Framework
Manage Development in Your Org with Salesforce Governance FrameworkSalesforce Developers
 
From Sandbox To Production: An Introduction to Salesforce Release Management
From Sandbox To Production: An Introduction to Salesforce Release ManagementFrom Sandbox To Production: An Introduction to Salesforce Release Management
From Sandbox To Production: An Introduction to Salesforce Release ManagementSalesforce Developers
 
Best Practices for Team Development in a Single Org
Best Practices for Team Development in a Single OrgBest Practices for Team Development in a Single Org
Best Practices for Team Development in a Single OrgSalesforce Developers
 
Performance Testing ISV Apps to Scale
Performance Testing ISV Apps to ScalePerformance Testing ISV Apps to Scale
Performance Testing ISV Apps to ScaleSalesforce Partners
 
Performance Testing ISV Apps to Scale 11/9/2016
Performance Testing ISV Apps to Scale 11/9/2016Performance Testing ISV Apps to Scale 11/9/2016
Performance Testing ISV Apps to Scale 11/9/2016Salesforce Partners
 
Understanding the Salesforce Architecture: How We Do the Magic We Do
Understanding the Salesforce Architecture: How We Do the Magic We DoUnderstanding the Salesforce Architecture: How We Do the Magic We Do
Understanding the Salesforce Architecture: How We Do the Magic We DoSalesforce Developers
 
TDX19 - Untangle Your Org with Salesforce Developer Tools
TDX19 - Untangle Your Org with Salesforce Developer ToolsTDX19 - Untangle Your Org with Salesforce Developer Tools
TDX19 - Untangle Your Org with Salesforce Developer ToolsDoug Ayers
 
Decoding Triggers for Admins
Decoding Triggers for AdminsDecoding Triggers for Admins
Decoding Triggers for AdminsSalesforce Admins
 
Managing Change With A Sensible Sandbox Architecture
Managing Change With A Sensible Sandbox ArchitectureManaging Change With A Sensible Sandbox Architecture
Managing Change With A Sensible Sandbox ArchitectureAlexander Sutherland
 
Simplify your code with Salesforce DX and module development
Simplify your code with Salesforce DX and module developmentSimplify your code with Salesforce DX and module development
Simplify your code with Salesforce DX and module developmentSalesforce Developers
 
Webinar: From Sandbox to Production: Demystifying Force.com Release Managemen...
Webinar: From Sandbox to Production: Demystifying Force.com Release Managemen...Webinar: From Sandbox to Production: Demystifying Force.com Release Managemen...
Webinar: From Sandbox to Production: Demystifying Force.com Release Managemen...Salesforce Developers
 
Understanding Multitenancy and the Architecture of the Salesforce Platform
Understanding Multitenancy and the Architecture of the Salesforce PlatformUnderstanding Multitenancy and the Architecture of the Salesforce Platform
Understanding Multitenancy and the Architecture of the Salesforce PlatformSalesforce Developers
 
Elevate Tel Aviv
Elevate Tel AvivElevate Tel Aviv
Elevate Tel Avivsready
 

Similar to Debug Log Surgeon (20)

Manage Salesforce Like a Pro with Governance
Manage Salesforce Like a Pro with GovernanceManage Salesforce Like a Pro with Governance
Manage Salesforce Like a Pro with Governance
 
Manage Development in Your Org with Salesforce Governance Framework
Manage Development in Your Org with Salesforce Governance FrameworkManage Development in Your Org with Salesforce Governance Framework
Manage Development in Your Org with Salesforce Governance Framework
 
From Sandbox To Production: An Introduction to Salesforce Release Management
From Sandbox To Production: An Introduction to Salesforce Release ManagementFrom Sandbox To Production: An Introduction to Salesforce Release Management
From Sandbox To Production: An Introduction to Salesforce Release Management
 
Development Best Practices
Development Best PracticesDevelopment Best Practices
Development Best Practices
 
Best Practices for Team Development in a Single Org
Best Practices for Team Development in a Single OrgBest Practices for Team Development in a Single Org
Best Practices for Team Development in a Single Org
 
Performance Testing ISV Apps to Scale
Performance Testing ISV Apps to ScalePerformance Testing ISV Apps to Scale
Performance Testing ISV Apps to Scale
 
Performance Testing ISV Apps to Scale 11/9/2016
Performance Testing ISV Apps to Scale 11/9/2016Performance Testing ISV Apps to Scale 11/9/2016
Performance Testing ISV Apps to Scale 11/9/2016
 
Understanding the Salesforce Architecture: How We Do the Magic We Do
Understanding the Salesforce Architecture: How We Do the Magic We DoUnderstanding the Salesforce Architecture: How We Do the Magic We Do
Understanding the Salesforce Architecture: How We Do the Magic We Do
 
TDX19 - Untangle Your Org with Salesforce Developer Tools
TDX19 - Untangle Your Org with Salesforce Developer ToolsTDX19 - Untangle Your Org with Salesforce Developer Tools
TDX19 - Untangle Your Org with Salesforce Developer Tools
 
Decoding Triggers for Admins
Decoding Triggers for AdminsDecoding Triggers for Admins
Decoding Triggers for Admins
 
Introduction to Apex Triggers
Introduction to Apex TriggersIntroduction to Apex Triggers
Introduction to Apex Triggers
 
Coding in the App Cloud
Coding in the App CloudCoding in the App Cloud
Coding in the App Cloud
 
Managing Change With A Sensible Sandbox Architecture
Managing Change With A Sensible Sandbox ArchitectureManaging Change With A Sensible Sandbox Architecture
Managing Change With A Sensible Sandbox Architecture
 
Simplify your code with Salesforce DX and module development
Simplify your code with Salesforce DX and module developmentSimplify your code with Salesforce DX and module development
Simplify your code with Salesforce DX and module development
 
The Apex Interactive Debugger
The Apex Interactive DebuggerThe Apex Interactive Debugger
The Apex Interactive Debugger
 
Get Started with Salesforce DX!
Get Started with Salesforce DX!Get Started with Salesforce DX!
Get Started with Salesforce DX!
 
Webinar: From Sandbox to Production: Demystifying Force.com Release Managemen...
Webinar: From Sandbox to Production: Demystifying Force.com Release Managemen...Webinar: From Sandbox to Production: Demystifying Force.com Release Managemen...
Webinar: From Sandbox to Production: Demystifying Force.com Release Managemen...
 
Adopting Salesforce DX
Adopting Salesforce DXAdopting Salesforce DX
Adopting Salesforce DX
 
Understanding Multitenancy and the Architecture of the Salesforce Platform
Understanding Multitenancy and the Architecture of the Salesforce PlatformUnderstanding Multitenancy and the Architecture of the Salesforce Platform
Understanding Multitenancy and the Architecture of the Salesforce Platform
 
Elevate Tel Aviv
Elevate Tel AvivElevate Tel Aviv
Elevate Tel Aviv
 

Recently uploaded

The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - InfographicHr365.us smith
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyFrank van der Linden
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...aditisharan08
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 

Recently uploaded (20)

The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Asset Management Software - Infographic
Asset Management Software - InfographicAsset Management Software - Infographic
Asset Management Software - Infographic
 
Engage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The UglyEngage Usergroup 2024 - The Good The Bad_The Ugly
Engage Usergroup 2024 - The Good The Bad_The Ugly
 
Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...Unit 1.1 Excite Part 1, class 9, cbse...
Unit 1.1 Excite Part 1, class 9, cbse...
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 

Debug Log Surgeon

  • 1. Become a Debug Log Surgeon Taking Your Dev Console Troubleshooting Skills to the Next Level jess.lopez@salesforce.com, @jjjlo Jess Lopez, NGO Technical Architect, Salesforce.org Customer Centric Engineering Forward-Looking Statements Statement Under the Private Securities Litigation Reform Act of 1995 This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. or Salesforce.org could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services. The risks and uncertainties referred to above include – but are not limited to – risks associated with Salesforce.org or as applicable Salesforce (referred to collectively as “we” and “our”) developing and delivering new functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our services and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to different market segments. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in its annual report on Form 10-K for the most recent fiscal year and in its quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of the Salesforce Web site. Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase salesforce.com services or the Salesforce.com-developed products and services should make the purchase decisions based upon features that are currently available. Salesforce.org assumes no obligation and does not intend to update these forward-looking statements.
  • 2. Step 1 Step 5 Step 4 Step 3 Step 2 NPSP / Managed Packages Where might we find errors? Order of Execution & Governor Limits Real World Example Common Errors and Strategies for Troubleshooting Step 6 Agenda The Dev Console Who am I? I went to college thinking I would become a surgeon.
  • 3. Who am I? I went to college thinking I would become a surgeon. Who am I? Today, I’m a Salesforce.org NGO Architect in Customer Centric Engineering.
  • 4. Who am I? It’s similar… kind of. Help! NPSP is doing this really strange thing for a customer and it’s causing them some major pain and headaches. Find and resolve the issue quickly! “ ” “Surgery” “Charts” “Grand Rounds” It’s similar… kind of. ● Capture logs and analyze with precision ● Review NPSP codebase ● Resolve issue; suggest resolution to customer; or escalate to Product team ● Case Escalations ● Investigations ● Github Issue “Novels” ● Case Studies ● Trainings/ Bootcamps “Diagnose Critical Issues” ● Run “tests” and analyze holistically. ● Determine root cause
  • 5. NPSP & Packages NPSP at a Glance NPSP = Nonprofit Success Pack Salesforce.org Product; foundation of Nonprofit Cloud Pre-built constituent and donor management components Built on Salesforce.com Flexible, open data architecture
  • 6. Maybe... Core Salesforce.com (EE or UE) Sales Cloud | Service Cloud SFDO Nonprofit Success Pack Volunteers for Salesforce Usually... Core SFDO Declarative and Programmatic Customizations Managed PackageManaged PackageManaged PackageManaged PackageManaged Package Salesforce.com (EE or UE) Sales Cloud | Service Cloud Nonprofit Success Pack Volunteers for Salesforce Marketing Cloud Communities
  • 7. Understanding Packages Unmanaged ● Editable components ● Can’t be upgraded or changed by package owner once installed ● Can see everything about the package in debug logs Managed ● Some components are editable; others are not. ● Fully upgradeable ● Push updates ● Can’t see many things about the package in debug logs Certified Managed Packages: ● On AppExchange ● Have gone through Security Review ● Get own set of limits for most per-transaction limits (DML, Query Limits, etc.) “A package is a container for something as small as an individual component or as large as a set of related apps. After creating a package, you can distribute it to other Salesforce users and organizations, including those outside your company.” Where might we find errors?
  • 8. Record-Level Errors Email / Chatter Notifications NPSP Settings → System Tools → Error Notifications ● Choose to send to specific User, System Admins, or Chatter group ● Typically related to our Scheduled Jobs
  • 9. Apex Jobs Errors Custom Object View and clear logs within NPSP Settings → System Tools → Error Logs Create reports on object, too!
  • 10. Order of Execution (Super High-Level) Validation Before Triggers Duplicate Rules Save, but don’t commit After Triggers Assignment Rules Auto-Response Rules Workflow Rules Processes / Flows Escalation Rules Entitlement Rules Roll-up Summaries (parents/grandparents) Criteria-based Sharing Rules Commit record Post-commit logic Governor Limits
  • 11. Limits, Allocations, and Limitations Allocations Edition-based constraints (e.g. # of Custom Objects, # of Validation Rules) Limits Concrete numeric values assigned to features/functionality (e.g. Max # of Sharing Rules) Limitations Expected but unavailable functionality (e.g. Importing Documents in the Data Import Wizard) Design-Time Limits Cross-Object Formulas Lots of vLookup Rules per object Picklists with lots of values Lots of Report Filters Sharing Rules Limits Criteria-Based Sharing Rules Max Child Relationships
  • 12. Run-Time Limits Total # of SOQL Queries Issued Total # of records retrieved by a SOQL Query Total # of DML Statements Issued Total Heap Size Maximum CPU Time Limit Maximum Transaction Execution Time Shared across everything in the transaction Certified managed packages have their own set Synchronous vs. Asynchronous Double or More! Source: Execution Governors and Limits Synchronous Asynchronous Total # of SOQL Queries 100 200 Total Heap Size 6MB 12MB Max CPU Time 10,000 ms 60,000 ms Max Async Apex Method Executions 250,000 (or # of licenses x 200) Max # of Batch jobs queued/active concurrently 5 Max # of Records Returned for Batch Apex query in QueryLocator 50,000,000
  • 13. Real World Scenario Let’s break it down. Record-Level Error Creating an Opportunity ”NPSP”… “TDTM_Opportunity…” “Sounds like an issue with NPSP… right?! Or is it…”
  • 14. Enter the Debug Log View exactly what’s happening Debug Logs capture database operations, system processes, and errors • View info on both declarative and programmatic customizations Debug Levels Crank it up or Dial it down ● Default = SFDC_DevConsole ● Segmented categories
  • 15. Creating New Trace Flag for a User ● Setup → Debug Logs: Manually set debug logging for User, Automated Process, Apex Class, or Apex Trigger ● Or if Dev Console open, will automatically capture. View the Debug Log Create an Opportunity again and view the log in Setup --> Debug Logs
  • 16. What’s in a Log Entry? 14:49:59.037 (37045000)|USER_DEBUG|[2]|DEBUG|Hello World! 15:51:01.071 (55856000)|DML_BEGIN|[5]|Op:Insert|Type:Invoice_Statement__c|Rows:1 Debug Log Limits Each Debug Log = 5 MB before truncation Retention: System = 1 day; Monitored = 7 days Total = 250MB in a 15 minute window
  • 17. Debug Log Limits Each Debug Log = 5 MB before truncation Retention: System = 1 day; Monitored = 7 days Total = 250MB in a 15 minute window Enter the Dev Console It’s not just for code. View Logs Create, view, and edit code Execute Anonymous Set/View Checkpoints in code Query Editor Query Plan (Help Menu → Preferences → Enable Query Plan = true)
  • 18. Let’s get a better view in the Dev Console If not already open, go to Debug → uncheck Show My Current Logs Only Still not great... So much text. NPSP is a managed package, so you won’t see some information. You will still see query information, general execution times, etc.
  • 19. What if we just switch our perspective? Predefined layouts of panels Dev Console Perspectives Default View is Log Only Switch to All, Analysis, or Debug for different views Save and create your own
  • 20. “All” Perspective Stack Tree Useful for digging into long-running operations Execution Tree: each item Performance: aggregate
  • 21. Execution Log Useful for troubleshooting execution times and to see how many records are being returned in each query Clicking on Query in Stack Tree, for instance, jumps to line in Execution Log Execution Overview Graphical View of Executed Units
  • 22. “Stairway to Heaven” Execution Overview Executed Units – with filtering! (Filter to Queries since this is related to Query Limits) This query might be the issue, since the Count is 100
  • 23. Execution Log Final Limits (default) - your limits NPSP’s limits - has own limits as a certified managed package Execution Log Let’s back up a few lines It wasn’t NPSP after all. It was custom code in RogueOpportunityHandler’s queryPayments() method. Because NPSP’s Opportunity trigger kicked it off, it surfaced the error.
  • 24. Common Errors & Strategies for Troubleshooting Too many query rows: 50001 Can’t query for more than 50,000 records at a time **** Dev Console Strategy • Execution Overview → Executed Units tab. Filter to only show Queries. Sort by Row columns (Descending) NPSP Scenario: • Legacy Rollups, Error Notifier General Strategies • Avoid data skew; distribute / archive • Add LIMIT to query • Add more filters • If related to a batch job, lower the batch size
  • 25. Too many dml rows: 10001 Can’t insert, update, upsert, delete, undelete, merge more than 10K records at once Dev Console Strategy • Execution Overview → Executed Units tab. Filter to only show DML. Sort by Row columns (Descending) NPSP Scenario: • Recurring Donation => Opportunity Distribution General Strategies • Avoid data skew; distribute / archive • Consider batching • If related to a batch job, lower the batch size • NPSP: Lower your Opportunity Forecast Month Settings or your Batch Size Settings in NPSP Settings Apex CPU Timeout Your execution took too long. Typically, there’s a lot of automation occurring. • Lots of triggers • Lots of packages • Lots of process builder processes, workflow rules, flows, validation rules • Recursion NPSP Scenario: • Contact Insertion • Closed/Won Opportunity Insertion Strategies • Lower batch sizes • Consider ways to optimize code / queries through best practices and platform options • This is a shared limit -- so consider ALL that’s happening for a single transaction.
  • 26. Too many query locator rows: 50000001 Batch Job start() method returned more than 50 million records NPSP Scenario • Opportunity Naming Batch Job • Customizable Rollups Batch Jobs ** Strategies • Add Limits / filters if applicable • Consider batch chunking / chaining • Data Archival REQUEST_RUNNING_TOO_LONG Usually the batch job’s start() query has timed out NPSP Scenario • Customizable Rollups Batch Jobs ** • Seasonal Address Batch Job ** Strategies • Make sure query is selective (use Query Plan tool) • Consider custom indexes, but code should be optimized first. There are also thresholds at play. Skinny Tables, too. • Reduce data with filters • Consider batch chunking/chaining
  • 27. Resources Platform Resources Salesforce Help • Logs Tab • Log Inspector • Debug Logs • Debug Log Levels ** • Debug Log Details • Examples of Using the Log Inspector • Debug Log Order of Precedence • Debug Log (Apex Developer Guide) Trailhead • Dev Console Basics • Write Efficient Queries • Build Efficient Applications without Limits Trail • Large Data Volumes • Strategies for Big Data Architecture • Find and Fix Bugs with Apex Replay Debugger
  • 28. NPSP Resources General • Github “Cumulus” Repository and Issues • General Product Documentation • Power of Us Hub Groups and Topics Trailhead • Administer NPSP Trail • Fundraise with Nonprofit Cloud Trail QUIZ!
  • 29. In Spring ‘19, what is the maximum size of a debug log (in megabytes)? 5 megabytes
  • 30. True or False: You can view all code from a managed package in a debug log. False
  • 31. How do you capture the logs for a Scheduled Apex Job that starts running at 4 a.m.? 1. Setup → Debug Logs 2. Create Trace Flag for running user of Scheduled Job 3. Set the Start Time to 4 a.m.
  • 32. What can you do if your logs are truncated? (A) Wait until the Summer ‘19 release to start troubleshooting (B) Delete your previous debug logs (C) Reduce one or more Category logging levels for your Debug Level (D) Download the debug log and view it in VS Code What can you do if your logs are truncated? (A) Wait until the Summer ‘19 release to start troubleshooting (B) Delete your previous debug logs (C) Reduce one or more Category logging levels for your Debug Level (D) Download the debug log and view it in VS Code
  • 33. True or False: Flows count toward SOQL Query Limits True. Record Update, Record Delete, Record Lookup, and Fast Lookup count.