I am using Dev Console Go to Debug->Open execute Anonymous window->Paste my line of code that I want to Debug but the window shows error :Line: 1, Column: 1

Enclosing type for global properties in apex classes must be declared as global

My apex:

global with sharing class DynamicController{
    global list<Dynamic__c> theresult{get;set;}
    global list<Dynamic__c> dynamicresult{get;set;}
    global String i{get;set;}
    global Apexpages.StandardSetController Accountserctrl{get;set;}

    global DynamicController(){
        String query = 'select name,Dynamic_content__c,Dynamic_image__c,Dynamic_release_time__c from Dynamic__c order by Dynamic_release_time__c';
        Dynamic__c a = [select id,Dynamic_image__c from Dynamic__c limit 1];
        String url = a.Dynamic_image__c.substringBetween('<img', 'img>');
        i = url.substringBetween('src="','"');
        theresult = Database.query(query);
        Accountserctrl = new Apexpages.StandardSetController(theresult);
        dynamicresult = Accountserctrl.getRecords();
  • 1
    You have changed your question to something completely different after receiving a few answers (which apparently addressed your problem). You would make it easier to help you in the long run if you instead accept the answer which you found most helpful and ask a new question about this completely separate issue.
    – Adrian Larson
    Mar 21, 2017 at 12:29

2 Answers 2


If you are using Dev Console Go to Debug->Open execute Anonymous window->Paste your line of code that you want to Debug and execute you can find the result at Logs

enter image description here


You might find this article a useful primer:

Set Up Debug Logging

To activate debug logging for users, Apex classes, and Apex triggers, configure trace flags and debug levels in the Developer Console or in Setup. Each trace flag includes a debug level, start time, end time, and log type. The trace flag’s log type specifies the entity you’re tracing.


Configure Trace Flags in the Developer Console

To configure trace flags and debug levels from the Developer Console, click Debug | Change Log Levels. Then complete these actions.

  • To create a trace flag, click Add.
  • To edit an existing trace flag’s duration, double-click its start or end time.
  • To change a trace flag’s debug level, click Add/Change in the Debug Level Action column. You can then edit your existing debug levels, create or delete a debug level, and assign a debug level to your trace flag. Deleting a debug level deletes all trace flags that use it.

Create Trace Flags in Setup

  1. From Setup, enter Debug Logs in the Quick Find box, then click Debug Logs.
  2. Click New.
  3. Select the entity to trace, the time period during which you want to collect logs, and a debug level. A debug level is a set of log levels for debug log categories: Database, Workflow, Validation, and so on. You can reuse debug levels across your trace flags.

See also: How do I start to debug my own Apex code?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .