Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » How to hook up a plugin's system.out with the debug console?
How to hook up a plugin's system.out with the debug console? [message #82884] Thu, 26 June 2003 06:48 Go to next message
Eclipse UserFriend
Originally posted by: michael.renz.web.de

My plugin is using system.err and system.out to output some information to
the debug console. When I run my plugin in the runtime platform (no
debugging mode, without PDE and JDT) I am not getting any output to the
console.

As I have seen, I somehow need to register a launch with the
DebugPlugin....but I couldn't find any more detailed information.

Anyone has some more information on the easiest way how to do that?

Or should I better create my own debug-view to output that information?

Thanks in advance.

Michael
Re: How to hook up a plugin's system.out with the debug console? [message #82960 is a reply to message #82884] Thu, 26 June 2003 07:36 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: schnider.aicas.com

To do that, you can use the eclipse launch framework.

From previous posts in eclipse.tools:
>Basically follow Eclipse help topic "Running a Java program" (second option)
>and do the same.
>Create new non-public LaunchConfigurationType and use it. It protects you
>from appearing this type in standard LaunchConfigurationDialog.


The following snippet creates a launch config and starts the application.
You need to create a working copy of the configuration to set its attributes.

---
ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
ILaunchConfigurationType type =
manager.getLaunchConfigurationType(
IExternalToolConstants.ID_PROGRAM_LAUNCH_CONFIGURATION_TYPE) ;

ILaunchConfigurationWorkingCopy wc = null;
try {
wc = type.newInstance(null, "MyApplication");
} catch (CoreException e) {
//some exception handling
}
wc.setAttribute(IExternalToolConstants.ATTR_LOCATION, "/usr/local/myApplication");
wc.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, arguments);
wc.setAttribute(IExternalToolConstants.ATTR_RUN_IN_BACKGROUN D, false);

//saving will add the configuration to the external tools configurations
ILaunchConfiguration config = wc.doSave();
config.launch(ILaunchManager.RUN_MODE, null);
---

You will need to add org.eclipse.ui.externaltools to your build path.
Using the launch framework will dispaly std.out/err in the eclipse consolse.

HTH
Roman


Michael Renz wrote:
> My plugin is using system.err and system.out to output some information to
> the debug console. When I run my plugin in the runtime platform (no
> debugging mode, without PDE and JDT) I am not getting any output to the
> console.
>
> As I have seen, I somehow need to register a launch with the
> DebugPlugin....but I couldn't find any more detailed information.
>
> Anyone has some more information on the easiest way how to do that?
>
> Or should I better create my own debug-view to output that information?
>
> Thanks in advance.
>
> Michael
>
Re: How to hook up a plugin's system.out with the debug console? [message #83018 is a reply to message #82960] Thu, 26 June 2003 09:13 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: michael.renz.web.de

Thanks, but if I am not mistaken, this looks much like a solution designed
to launch external Java applications.

What I am looking for is more like a self-registering solution integrated
in my plugin. So that it registers its process during startup with the
debug plugin.

I am not sure whether this can be done in this way.

Michael


Roman Schnider wrote:

> To do that, you can use the eclipse launch framework.

> From previous posts in eclipse.tools:
> >Basically follow Eclipse help topic "Running a Java program" (second
option)
> >and do the same.
> >Create new non-public LaunchConfigurationType and use it. It protects you
> >from appearing this type in standard LaunchConfigurationDialog.


> The following snippet creates a launch config and starts the application.
> You need to create a working copy of the configuration to set its attributes.

> ---
> ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
> ILaunchConfigurationType type =
> manager.getLaunchConfigurationType(
> IExternalToolConstants.ID_PROGRAM_LAUNCH_CONFIGURATION_TYPE) ;

> ILaunchConfigurationWorkingCopy wc = null;
> try {
> wc = type.newInstance(null, "MyApplication");
> } catch (CoreException e) {
> //some exception handling
> }
> wc.setAttribute(IExternalToolConstants.ATTR_LOCATION,
"/usr/local/myApplication");
> wc.setAttribute(IExternalToolConstants.ATTR_TOOL_ARGUMENTS, arguments);
> wc.setAttribute(IExternalToolConstants.ATTR_RUN_IN_BACKGROUN D, false);

> //saving will add the configuration to the external tools configurations
> ILaunchConfiguration config = wc.doSave();
> config.launch(ILaunchManager.RUN_MODE, null);
> ---

> You will need to add org.eclipse.ui.externaltools to your build path.
> Using the launch framework will dispaly std.out/err in the eclipse consolse.

> HTH
> Roman


> Michael Renz wrote:
> > My plugin is using system.err and system.out to output some information to
> > the debug console. When I run my plugin in the runtime platform (no
> > debugging mode, without PDE and JDT) I am not getting any output to the
> > console.
> >
> > As I have seen, I somehow need to register a launch with the
> > DebugPlugin....but I couldn't find any more detailed information.
> >
> > Anyone has some more information on the easiest way how to do that?
> >
> > Or should I better create my own debug-view to output that information?
> >
> > Thanks in advance.
> >
> > Michael
> >
Re: How to hook up a plugin's system.out with the debug console? [message #83278 is a reply to message #82884] Thu, 26 June 2003 13:35 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: richkulp.NOSPAM.us.ibm.com

Do you mean you started your target eclipse platform that has the plugin
installed in it (i.e. through eclipse.exe)? If that, then use
-consoleLog as an option to eclipse.exe. It will then show up in the
Windows command line window that you typed eclipse.exe into.

If you mean show up in a console window in the SAME RUNNING eclipse IDE
as the plugin is installed, as above, but in the console instead, then
that doesn't make sense because consoles are for applications that are
launched, not for the IDE itself.

If you mean you started your target eclipse through a Launch
RuntimeWorkbench configuration, then it should show up in the console
window of the IDE that executed the launch. There shouldn't be any
reason it doesn't. Make sure though the console for your launched IDE is
currently selected in the console. There can be more than one so yours
may be underneath under one and so you don't see it. Click on the down
arrow on the Console's action bar on the guy that has a little running
man and the hover help that syas "Display output of selected process"
and then select the one that is your launched eclipse.

Rich
Re: How to hook up a plugin's system.out with the debug console? [message #83385 is a reply to message #83278] Thu, 26 June 2003 16:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: michael.renz.web.de

Sorry, seems like I was not clear enough in what I want to do.
I am using the eclipse platform as a framework (runtime environment) for
my application, which comes as a plugin for that "plain" platform. So I
have my plugin installed in that platform and I am executing this this
platform.
I don't want to collect all the std.outs/errs of the whole platform
including all installed plugins but only for "my" plugin in the console
which is included in the org.eclipse.debug plugin.

So far I thought that each plugin has at least one own main thread,
therefore it might be possible to setup the console to the output streams
of that thread.

Therefore I guess, what I mean is close to the second case you mentioned.

Michael


Richard L. Kulp wrote:

> Do you mean you started your target eclipse platform that has the plugin
> installed in it (i.e. through eclipse.exe)? If that, then use
> -consoleLog as an option to eclipse.exe. It will then show up in the
> Windows command line window that you typed eclipse.exe into.

> If you mean show up in a console window in the SAME RUNNING eclipse IDE
> as the plugin is installed, as above, but in the console instead, then
> that doesn't make sense because consoles are for applications that are
> launched, not for the IDE itself.

> If you mean you started your target eclipse through a Launch
> RuntimeWorkbench configuration, then it should show up in the console
> window of the IDE that executed the launch. There shouldn't be any
> reason it doesn't. Make sure though the console for your launched IDE is
> currently selected in the console. There can be more than one so yours
> may be underneath under one and so you don't see it. Click on the down
> arrow on the Console's action bar on the guy that has a little running
> man and the hover help that syas "Display output of selected process"
> and then select the one that is your launched eclipse.

> Rich
Re: How to hook up a plugin's system.out with the debug console? [message #83925 is a reply to message #83385] Fri, 27 June 2003 10:19 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.NOSPAM.us.ibm.com

If I'm understanding correctly, you are not using Launch Runtime
Workbench to launch the eclipse that your plugin is installed into.

In that case the console doesn't make any sense. The console is for
OTHER APPLICATIONS that the platform has launched. It is not for output
from the platform itself. An application is a completely separate
java.exe instance from the one running the eclipse platform.

You are talking about Eclipse plugins, no? There is another java concept
of plugin which I know nothing about.

As for Eclipse plugins, they do not have their own thread. You can think
of plugins as simply a library of code. This code can be called at any
time and any thread from the eclipse base. What the plugin concept gives
you is a dynamic way of adding code to eclipse without having to
recompile eclipse each time.

Also, as for system.out, there is only one per java.exe, so there is no
way to distinquish which thread placed output onto the system.out.

Rich
Previous Topic:Cannot debug because Eclipse fails to find the source of my class
Next Topic:[CVS] automate maintenance correction commits
Goto Forum:
  


Current Time: Wed Jul 23 12:30:27 EDT 2025

Powered by FUDForum. Page generated in 0.47607 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top