Pages

Tuesday, February 22, 2011

Using Notepad++ to make Apex Test Runner Debug output readable

When running the Apex Test Runner in Eclipse with the Log level set to Debug it can be difficult to see your debug messages through the noise of method entry and method exit messages.

Notepad++

I've been copying the output into Notepad++ and then using the RegExs ^.+METHOD_.+$ and ^.+CONSTRUCTOR_.+$ followed by[ TextFX > TextFX Edit > Delete Blank Lines] to clean up the output.

With v5.8.7 I was able to combine all this into a Macro.

Visual Studio 2010

Better yet, copy it into a Visual Studio 2010 txt file and add a \n to the end of each regex.

Eclipse

Another good option is to adjust the amount of logging that occurs in the first place. See Setting Debug Log Filters

System Log | Force.com Console | Developer Console

The online logging has come a long way since this was first posted. Assuming the log isn't too big you can now Filter the execution log directly online.

See also:

3 comments:

  1. instead of that, you can change the logic around to just get the user_debug statements.

    In notepad++, here's the regex to use, and then clean it up in text/fx

    ^(?!.+USER_DEBUG.+$).*$

    ReplyDelete
    Replies
    1. I don't think Notepad++ supports the regex lookaround constructs (the Negative lookahead part (?! ) )

      Delete
    2. Ah, I take that back. With Notepad 6.1 they are supported. I was previously using an older 5.x version that didn't support them.

      Delete