Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

How to Grab Eclipse Console Output Painlessly

DZone's Guide to

How to Grab Eclipse Console Output Painlessly

· Java Zone
Free Resource

The single app analytics solutions to take your web and mobile apps to the next level.  Try today!  Brought to you in partnership with CA Technologies

In your plugin, if you want to do something with each line of your eclipse output console, for example write that line to a file, or parsing it before sending it to your custom eclipse view, you should create a class which implements IConsoleLineTracker, and you should add this extension point to your plugin.xml.

[img_assist|nid=1032|title=|desc=The steps are explained well here...|link=none|align=none|width=256|height=192]

Now, suppose your class implementing IConsoleLineTracker is this:

public class LogTracker implements IConsoleLineTracker {

private IConsole m_console;

public void dispose() {

}

public void init(IConsole console) {
m_console = console;
}

public void lineAppended(IRegion region) {
try {
String line = m_console.getDocument().get(region.getOffset(), region.getLength());

// DO SOMETHING WITH THAT LINE
} catch (BadLocationException e) {
WrCheck.logError(e);
}
}
}

CA App Experience Analytics, a whole new level of visibility. Learn more. Brought to you in partnership with CA Technologies.

Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}