Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Model-to-Model Transformation » qvto log() messages in java
qvto log() messages in java [message #1022685] Fri, 22 March 2013 10:57 Go to next message
Miriam Hundemer is currently offline Miriam Hundemer
Messages: 12
Registered: February 2013
Junior Member
Hi,

is there any way to display the log messages created with qvto's log() function in the eclipse console when calling the QVTO transformation from within an java class?

Thank you,

Miriam
Re: qvto log() messages in java [message #1022827 is a reply to message #1022685] Fri, 22 March 2013 15:48 Go to previous messageGo to next message
Ed Willink is currently offline Ed Willink
Messages: 4098
Registered: July 2009
Senior Member
Hi

All the logging occurs to a org.eclipse.m2m.qvt.oml.util.Log, so make
sure you configure an appropiate logger for your purposes.

Regards

Ed Willink


On 22/03/2013 10:57, Miriam Hundemer wrote:
> Hi,
>
> is there any way to display the log messages created with qvto's log()
> function in the eclipse console when calling the QVTO transformation
> from within an java class?
>
> Thank you,
>
> Miriam
Re: qvto log() messages in java [message #1022854 is a reply to message #1022827] Fri, 22 March 2013 16:42 Go to previous messageGo to next message
Fabio L. S. is currently offline Fabio L. S.
Messages: 15
Registered: July 2010
Location: Brazil
Junior Member
Hi Miriam;

I've implemented this feature by setting the OutputStream of the console as the log of the execution context.

To do this, you have to obtain the console window of Eclipse. The details are described here: http://wiki.eclipse.org/FAQ_How_do_I_write_to_the_console_from_a_plug-in%3F

The MessageConsoleStream obtained from the console should be used to create a WriterLog (org.eclipse.m2m.qvt.oml.util.WriterLog). For instance:

Log log = new WriterLog(new OutputStreamWriter(output));

The log is an "org.eclipse.m2m.qvt.oml.util.Log", as Ed pointed out. Then it can be when setting the executing environment details (look for the code section "setup the execution environment details" in http://wiki.eclipse.org/QVTOML/Examples/InvokeInJava). The log can be used simply as:

context.setLog(log);

Hope I haven't forgot any details Wink

Regards;


Fabio Levy Siqueira
Re: qvto log() messages in java [message #1023957 is a reply to message #1022854] Mon, 25 March 2013 14:44 Go to previous message
Miriam Hundemer is currently offline Miriam Hundemer
Messages: 12
Registered: February 2013
Junior Member
Hi,

thanks for your answers and sorry for the newbie question. Once you know how things are supposed to be done they are not quite so complicated than they appear to be at first.
I solved the problem now by simply defining a Logger for my Execution just as Ed suggested.

OutputStreamWriter outStream = new OutputStreamWriter(System.out);
Log log = new WriterLog(outStream);


And then using the log:

context.setLog(log);


Just like that Razz
Previous Topic:using blackbox in a qvt transformation called by java
Next Topic:[QVTo] how to use two target sources?
Goto Forum:
  


Current Time: Sat Oct 25 22:16:21 GMT 2014

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

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