Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » AMP » printing messages on console
printing messages on console [message #743258] Fri, 21 October 2011 09:22 Go to next message
giorgos  is currently offline giorgos Friend
Messages: 6
Registered: October 2011
Junior Member
Hello,
I would like to ask how I could print some messages or information about the values of some variables for example, on the console or in a log file during model execution. I used System.out.println() in the body of a Rule method but it does not appear to work.
Re: printing messages on console [message #743658 is a reply to message #743258] Fri, 21 October 2011 16:39 Go to previous messageGo to next message
Miles Parker is currently offline Miles ParkerFriend
Messages: 1340
Registered: July 2009
Senior Member
Did you check the System console? They won't go directly to the Eclipse console unless you're running in self-hosted mode.
Re: printing messages on console [message #747829 is a reply to message #743658] Mon, 24 October 2011 10:01 Go to previous messageGo to next message
giorgos  is currently offline giorgos Friend
Messages: 6
Registered: October 2011
Junior Member
How can I check the System console? Furthermore, I've tried to send the messages to a file. The code I wrote inside the Rule method is the following :

try{
// Create file

java.io.FileWriter fstream = new java.io.FileWriter("out.txt");
java.io.BufferedWriter out = new java.io.BufferedWriter(fstream);
out.write("Hello");
out.close();

}catch (Exception e){//Catch exception if any

System.err.println("Error: " + e.getMessage());
}
When I execute the model, no such file is created in the workspace. However, when I put this code in a class in another project and run it as a java application it works. Do you have any idea about why it works in the second case and not in the first?
Re: printing messages on console [message #756103 is a reply to message #747829] Thu, 10 November 2011 22:44 Go to previous message
Miles Parker is currently offline Miles ParkerFriend
Messages: 1340
Registered: July 2009
Senior Member
Wow, I'm still not getting notifications. Sad Sorry for the late reply.

The relative location of any files is going to be wherever you started Eclipse, *not* the workspace. Try an absolute file location, or use the Eclipse file API.

For the system console, that's system specific. For example on the Mac it's in Applications/Utilities.
Previous Topic:Debugging an escape model
Next Topic:Escape tutorial Plug-in dependency issues
Goto Forum:
  


Current Time: Sun Nov 23 05:05:41 GMT 2014

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

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