Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 146807

Summary: [launcher] Support for piping the output from the console
Product: [Eclipse Project] Equinox Reporter: Christophe Elek <celek>
Component: FrameworkAssignee: equinox.framework-inbox <equinox.framework-inbox>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: aniefer, egalvez, jeffmcaffer, martin.gutschelhofer, pascal, rngadam
Version: 3.2   
Target Milestone: 3.3 M7   
Hardware: PC   
OS: Windows 2000   
Whiteboard:
Bug Depends on: 173962    
Bug Blocks:    

Description Christophe Elek CLA 2006-06-13 08:00:04 EDT
I tried:

C:\eclipse>eclipse -vmargs -Declipse.consoleLog=true -debug > result.txt
and tried to change the eclipse.ini, adding -vmargs

As hinted in the doc, but the file is not generated
I still see the second command prompt opening.

The issue is , when eclipse crashes, we have no time to 'cut and paste' the content of the window...



Maybe I am not doing it right :( Could the doc be updated if this is the case ? Maybe some examples ?
Comment 1 Thomas Watson CLA 2006-06-13 09:19:21 EDT
The eclipse.exe uses the "javaw" executable from your JRE by default.  The javaw exe does not pipe output.  To do what you want you need to use the "java" executable.  Try the following command (using the -vm option to specify the path to the java exe):

eclipse -vm <path to jre bin>\java -debug -vmargs -Declipse.consoleLog=true > result.txt

Comment 2 Christophe Elek CLA 2006-06-13 09:30:00 EDT
Morning Thomas,

Hmmmmmm

This is what I run

E:\eclipse32m6\eclipse>eclipse -vm jre\bin\java.exe -debug -vmargs -Declipse.consoleLog=true > result1.txt


This is what I see in the file


E:\eclipse32m6\eclipse>type result1.txt
Start VM: E:\eclipse32m6\eclipse\jre\bin\java.exe
-Declipse.consoleLog=true
-jar E:\eclipse32m6\eclipse\startup.jar
-os win32
-ws win32
-arch x86
-launcher E:\eclipse32m6\eclipse\eclipse.exe
-name Eclipse
-showsplash 600
-exitdata 1194_380
-vmargs
-Xms40m
-Xmx256m
-debug
-vm E:\eclipse32m6\eclipse\jre\bin\java.exe
-vmargs
-Declipse.consoleLog=true
-jar E:\eclipse32m6\eclipse\startup.jar



This is what I see in the console window that opens. I do not see that in the file..


Install location:
    file:/e:/eclipse32m6/eclipse/
Configuration file:
    file:/e:/eclipse32m6/eclipse/configuration/config.ini loaded
Configuration location:
    file:/e:/eclipse32m6/eclipse/configuration/
Framework located:
    file:/e:/eclipse32m6/eclipse/plugins/org.eclipse.osgi_3.2.0.v20060328.jar
Framework classpath:
    file:/e:/eclipse32m6/eclipse/plugins/org.eclipse.osgi_3.2.0.v20060328.jar
Splash location:
    e:\eclipse32m6\eclipse\plugins\org.eclipse.platform_3.2.0.v20060329\splash.b
mp
runCommand:
    <E:\eclipse32m6\eclipse\eclipse.exe><-name><Eclipse><-showsplash><600><e:\ec
lipse32m6\eclipse\plugins\org.eclipse.platform_3.2.0.v20060329\splash.bmp>
Debug options:
    file:/E:/eclipse32m6/eclipse/.options not found
Time to load bundles: 20
Comment 3 Thomas Watson CLA 2006-06-13 09:46:56 EDT
Opps.  I forgot the eclipse.exe spawns a separate process which brings up another command prompt window.  This prevents you from piping the output as well.  You will have to bypass the eclipse.exe altogether.  Just use the java command with the following from your eclipse installation directory:

jre\bin\java.exe -jar startup.jar -debug -consoleLog > result1.txt

Notice the use of -consoleLog instead of -Declipse.consoleLog=true
Comment 4 Christophe Elek CLA 2006-06-13 10:08:49 EDT
Hmm, yeah.. that's the issue :(

Ok, should I keep this one open as an enhancement ? So we can 'dump' the content into a file ?
Is this the proper component ?
Comment 5 Ricky Ng-Adam CLA 2006-10-23 11:57:10 EDT
It would be really useful if there was something I could change in the .options to be able to have the whole log in a file instead of copy/pasting the console output or launching eclipse myself as in comment #3.

Can this be an RFE?
Comment 6 John Arthorne CLA 2006-10-23 15:18:14 EDT
Ricky: the log is already in a file: workspace/.metadata/.log. This bug is about piping standard output to a file. Since all shells have support for this already it seems like unnecessary work to add something like this... -debug is just used by plugin developers during development, and isn't intended for end-users anyway.
Comment 7 Christophe Elek CLA 2006-10-23 15:34:08 EDT
John, -debug is heavily used by Support to trace the execution of a plugin
The issue is that by bypassing the eclipse.exe we
1) *may* change the behavior
2) need to explain to a user: ok, do no click on the icon, instead open a command prompt window, go where eclipse is installed, now run.. java...
no very friendlyThe problem with piping is on windows, it seems to run javaw from eclipse.exe instead of java, so the console is not really the one that is 'pipable' (sic) :)

I also noticed that not all the info from -debug appear in the configuration/*.log file nor the .metadata/.log

Maybe the proposal os Platform UI for a better message handler could be move to core ? :D
Cheers
Comment 8 Pascal Rapicault CLA 2006-10-23 21:14:31 EDT
Moving to where it belongs and cc Andrew who has been looking at the launcher.
Comment 9 Jeff McAffer CLA 2006-10-23 21:27:49 EDT
Yes, the JNI launching story would help here.  

As for comment 6, is this really true?  Quite often when plugins handle debug mode they just use System.out.  Is this somehow captured in the .log file?
Comment 10 Andrew Niefer CLA 2007-05-02 16:05:47 EDT
Starting in I20070430-0800, we now have an eclipsec.exe which is a console linked version of the launcher.  Piping output works with this launcher when the vm is started with JNI (the default if no -vm argument is given).
Comment 11 Christophe Elek CLA 2007-05-25 16:21:19 EDT
Verified, works like a charm :)
Comment 12 Eddie Galvez CLA 2010-06-14 11:16:39 EDT
I'd like to know if eclispec can be made to be used by a PDE product build as the exe? Imagine using PDE (headless) build for a product that is a console application; I'd like to use eclipsec in this case!
Comment 13 Eddie Galvez CLA 2010-06-14 11:17:32 EDT
Ah, I found my last comment already has a ticket:  Bug 185207