| 일 | 월 | 화 | 수 | 목 | 금 | 토 | 
|---|---|---|---|---|---|---|
| 1 | ||||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 | 
| 9 | 10 | 11 | 12 | 13 | 14 | 15 | 
| 16 | 17 | 18 | 19 | 20 | 21 | 22 | 
| 23 | 24 | 25 | 26 | 27 | 28 | 29 | 
| 30 | 
- developer console
 - BASIC
 - object setting
 - difference with java
 - Too many SOQL queries
 - VARIABLE
 - Administrator
 - salesforce
 - sales cloud consultant
 - apex
 - apex class
 - platform developer1
 - sObject
 - deactivate record type for chatter user profile
 - DML Statement
 - System.LimitException
 - sharing
 - development link
 - service cloud consultant
 - Too many DML statements
 - Database Methods
 - chatter user profile
 - google extension
 - dump
 
- Today
 
- Total
 
어느 Salesforce Developer의 개발 성장기
Developer Console 기본편(4)-Inspect Objects at Checkpoints 본문
Developer Console 기본편(4)-Inspect Objects at Checkpoints
Developer_Foryou 2020. 3. 9. 19:58Set Checkpoints in your apex code
Checkpoint는 code가 실행되는 과정의 특정 부분에서 어떤 일이 일어나는지 snapshot을 보여준다.
Let's set a checkpoint
- Select File | Open, and open the EmailMissionSpecialist class.
 - Select Debug | Change Log Levels.
 - In the General Trace Settings for You section, click Add/Change.
 - Set the ApexCode log level to FINEST.
 - To save your changes, click Done.
 - To exit the Change Log Levels dialog box, click Done.
 
※ 주의
- Checkpoint를 설정하기 위해서 당신은 모든 데이터를 볼 수 있는 사용자 권한이 필요하다.
 - Checkpoint를 사용하여 결과를 발생시키기 위해 execute anonymous window에서 실행하거나 DEVELOPER_LOG trace flag를 설정해야한다.
 - Trace flag는 log level이 INFO이상이어야한다.
 
Source Code 왼쪽의 Code Line을 클릭하여 Checkpoint를 만들면, Checkpoints tab에서 확인할 수 있다.

Checkpoints tab
Checkpoints tab을 통해서 코드의 실행이 잘못되고있는 지점과 그 시점에있는 객체의 값을 정확히 볼 수 있다.
ex. 위 이미지와 같이 Source Code 왼쪽의 Code Line을 클릭하여 Checkpoint를 만든 후, Debug | Open Execute Anonymous Window에서 다음 코드를 실행하면 Checkpoints tab에서 확인할 수 있다.
(Enter your email address 대신에 확인할 수 있는 이메일 주소 입력)
EmailMissionSpecialist em = new EmailMissionSpecialist();
em.sendMail('Enter your email address', 'Flight Path Change',
'Mission Control 123: Your flight path has been changed to avoid collision '
+ 'with asteroid 2014 QO441.');

Checkpoints 표에서 checkpoint를 더블 클릭하면 캡쳐된 결과 값을 볼 수 있다.
Checkpoint inspector
Checkpoints에는 Heap tab과 Sysbols tab이 있다.
Heap - 실행 된 코드 줄에서 메모리에 있는 모든 개체를 표시
Sysbols - 메모리의 모든 Sysbol을 Tree view로 표시
Heap Tab

Heap tab에는 Types 패널과 같은 디버깅을 위한 패널이 포함되어 있다. 이 패널은 얼마나 많은 객체가 인스턴스화되었고 그들이 소비 한 메모리를 바이트 단위로 보여준다.
- Under Types, click Messaging.SingleEmailMessage.
 - Under Instances, click any instance of this object type.
 - Under State, view the object’s fields and their values.
 
Symbols Tab

Symbols 탭은 모든 Checkpoint에서 다양한 Object의 상태를 빠르고 간단하게 검토 할 수있는 방법이다. 
Symbol은 특정 Obejct를 참조하는 고유한 이름이다. 이 탭은 Tree view를 사용하여 메모리에 있는 모든 Symbol을 표시한다.
※ 주의
Checkpoint Result는 Checkpoint 설정한 코드가 실행되지 않으면 Checkpoints가 생성되지 않는다.
'Salesforce > Developer Tools' 카테고리의 다른 글
| Developer Console 기본편(4)-Execute SOQL and SOSL Queries (0) | 2020.03.09 | 
|---|---|
| Developer Console 기본편(3)-Generate and Analyze Logs (0) | 2020.03.08 | 
| Developer Console 기본편(2)-Navigate and Edit Source Code (0) | 2020.03.08 | 
| Developer Console 기본편(1)-Get Started with the Developer Console (0) | 2020.03.08 |