English 中文(简体)
如何使该制度公正。 在实施守则时减少产出?
原标题:How to get just the system.debug output when executing code?

我写了一个简单的方案,希望在我管理该守则时看到产出。 当我执政时。 辩论发言。 我可以使用笔记或外表,但似乎同样应该采取直接的方式(无论是本土还是工具)。 任何建议?

感谢

el-noobre

守则

<守则>public with sharing class Aa_playground {



 public static void listExp(){
    List<Integer> x = new List<Integer>();
    x.add(1212);
    for (Integer i = 0; i < x.size(); i++){
        System.debug(x[i]);
    }

}
} 

产出

<守则>Anonymous execution was successful.

24.0     APEX_CODE,DEBUG;APEX_PROFILING,INFO;CALLOUT,INFO;DB,INFO;VALIDATION,INFO;WORKFLOW,INFO
Execute Anonymous: Aa_playground.listExp();
13:40:52.037 (37218000)|EXECUTION_STARTED
13:40:52.037 (37228000)|CODE_UNIT_STARTED|[EXTERNAL]|execute_anonymous_apex
13:40:52.037 (37634000)|METHOD_ENTRY|[1]|01pQ000000062u5|Aa_playground.Aa_playground()
13:40:52.037 (37726000)|METHOD_EXIT|[1]|Aa_playground
13:40:52.037 (37740000)|METHOD_ENTRY|[1]|01pQ000000062u5|Aa_playground.listExp()
13:40:52.037 (37920000)|USER_DEBUG|[9]|DEBUG|1212
13:40:52.037 (37947000)|METHOD_EXIT|[1]|01pQ000000062u5|Aa_playground.listExp()
13:40:52.594 (37979000)|CUMULATIVE_LIMIT_USAGE
13:40:52.594|LIMIT_USAGE_FOR_NS|(default)|
  Number of SOQL queries: 0 out of 100
  Number of query rows: 0 out of 50000
  Number of SOSL queries: 0 out of 20
  Number of DML statements: 0 out of 150
  Number of DML rows: 0 out of 10000
  Number of script statements: 5 out of 200000
  Maximum heap size: 0 out of 6000000
  Number of callouts: 0 out of 10
  Number of Email Invocations: 0 out of 10
  Number of fields describes: 0 out of 100
  Number of record type describes: 0 out of 100
  Number of child relationships describes: 0 out of 100
  Number of picklist describes: 0 out of 100
  Number of future calls: 0 out of 10

13:40:52.594|CUMULATIVE_LIMIT_USAGE_END

13:40:52.038 (38005000)|CODE_UNIT_FINISHED|execute_anonymous_apex
13:40:52.038 (38011000)|EXECUTION_FINISHED
最佳回答

我在答复中总结一下我发现的一些信息。

  1. Download Notepad++ v6.1+
  2. In Notepad++, open (or paste in) your debug log file.
  3. From the Menu, select Macro > Start Recording.
  4. Press CTRL-H (or the shortcut for Search and Replace).
  5. Copy this regular expression ^(?!.+USER_DEBUG.+$).*$ and paste it in the "Find What:" textbox.
  6. Make sure the Search Mode is set to Regular Expression and that the "Replace With:" textbox is blank.
  7. Click "Replace All" and "Ok" when the result dialog apprears.
  8. Copy this regular expression (?m)^([ s]*|;.*)( ? |$) and paste it in the "Find What:" textbox.
  9. Make sure the Search Mode is set to Regular Expression and that the "Replace With:" textbox is blank.
  10. Click "Replace All" and "Ok". Then, close the Search and Replace dialog.
  11. From the Menu, select Macro > Stop Recording. Then select Macro > Save Current Recorded Macro.
  12. Enter a Name for your new macro, and optionally set the shortcut keys. Then click "Ok".

为了执行你的新的宏观,从菜单中挑选Macro,然后点击你的宏观名称。

定期表示的贷项可到。 (见问题评论)。 Daniel Ballinger s blog post也是有用的。

问题回答

这可能是坏的做法,但我过去所做的事情是,将APEX_CODE到INFO的标识水平确定下来,并设定变幻灯的标识水平。

System.debug(Logginglevel.INFO,  Debug Message with INFO level );

页: 1 LiMIT_USAGE_FOR_NS information by establishing the Apex Profiling level to None. 但是,你可以删除<代码>。 METHOD_ENTRY和 methHOD_EXIT 电文,现存 USER_DEBUG 讯息,因为这些信息高于。 过滤器中的系统(信号。 遗憾的是。





相关问题
Salesforce - Populate text are from drop down selection

I have a picklist with three values and a text area that has three values as well, but I would like to correlate one value from the picklist with one value of the text area. Any thoughts as on how I ...

Setting Timeout value for Salesforce Web Service/API

The API for Salesforce is a web service, you set it up by downloading a WSDL file from Salesforce and adding the WSDL to your .NET project. But I can t find anywhere to set the Timeout value. ...

Salesforce Custom Objects

Hi I am trying to create a Custom Object in Salesforce.com Developer Edition, because I would then like to use this Custom Object in a New Custom Tab say "Properties". Properties tab will contain ...

热门标签