Easiest way to filter Eclipse or FlexBuilder console output (trace statements)

UPDATE: This looks like a good fit Grep Console

I’m asking this in relation to Flex Builder, but it might apply to Eclipse in general.

Trace statements in Flex Builder get sent to an Eclipse Output Console. What is the easiest way to filter this text on the Eclipse side?

Specifically, I’d like to be able to filter (ignore) lines by patterns.

I came across Logback, but it seems like overkill for this scenario. Is there no way to script something like this Eclipse itself?

The question has been asked on Stack Overflow here:

http://stackoverflow.com/questions/669369/easiest-way-to-filter-eclipse-console-output-text

Background

I’m sure that custom built logging tools have their place, but I believe that simple trace statements can be very useful – especially when dealing with Open Source libraries where it would be impossible to agree on a standard logging tool to use.

Logging tools also add overhead. The nice thing about trace statements is that they don’t get compiled into your Release Build SWF. The only way to achieve this with a logging tool is to use Conditional Compilation – not very convienient to have to wrap every log call. Even if the logging tool has an “off” switch for Release Builds, there will still be overhead when calling the log function (even if it simply returns directly after being called, there is still the overhead of calling the function).

If there was an easy way to filter trace output on the Eclipse side we could ignore statements that we are not currently interested in (those coming from an external library for example) so long as those statements start with a certain pattern.

I’m building an application with SmartyPants-IOC at the moment and it traces a hell-of-a-lot. Luckily, all of it’s trace statements look something like this:

[DEBUG] The object ([object TermsPanelMediator]) has 4 injection points.

I’m also using a little framework that I’m building called RobotLegs which makes trace statements that look like this:

[ROBOTLEGS] MediatorFactory::createMediator – Mediator created for View Component: PijinFlex3_0.TermsPanel30

And my application might make trace statements that look like this:

[MYAPP] What the hell is going on here?! This isn’t a real example!

If I could ignore lines that begin with a certain pattern I would be very happy!

The Solution

Stack Overflow pointed me to Grep Console which can highlight patterns in the output console. Very cool.

So, I can highlight my trace statements with expressions like this:

.*(Q[DEBUG]E).*
.*(Q[ROBOTLEGS]E).*
.*(Q[MYAPP]E).*

With different colours assigned to each expression I get something almost as good as removing unwanted traces.

Grep Console Eclipse Plugin

Grep Console Eclipse Plugin

Posted in Questions | Tagged , , , , , , | 1 Comment
  • http://www.pedropinheiro.com Ptrpinheiro

    Hello,
    this is the usual regular expressions? (*(Q[DEBUG]E).*) what is the leading Q and suffix E means?
    Thanks,
    Pedro