Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Advanced Scripting Environment (EASE) » Logging from Java Class
Logging from Java Class [message #1730120] Thu, 21 April 2016 13:35 Go to next message
Daniel K. is currently offline Daniel K.Friend
Messages: 11
Registered: May 2012
Junior Member
Hi,
we are currently investigating EASE.
We have the following constellation:
Existing Java Classes which we want to reuse in the scripts, as there is already functionality implemented. In general this works, as I can instantiate them and then work.
Currently we have also log statements included by using Log4J / Sysout, but these statements are nowhere logged.
What needs to be done to get one common output from JavaScript and calles Java Classes? We are also able to inject a dedicated log class, which is doing this.
Any hint from your side?

Regards
Daniel
Re: Logging from Java Class [message #1730137 is a reply to message #1730120] Thu, 21 April 2016 16:41 Go to previous messageGo to next message
Christian Pontesegger is currently offline Christian PonteseggerFriend
Messages: 250
Registered: July 2009
Location: Graz, Austria
Senior Member
Hi,

basically it boils down to either reuse the output stream of the curent script engine or to set the output stream of the engine to something else.

You may call getScriptEngine() anywhere in your script to get access to the current engine (you might have multiple running at the same time). Then use either getOutputStream() / setOutputStream() to either access or change where the engine print to.
getScriptEngine().setOutputStream(java.lang.System.out) // let engine print to System.out

Similar methods are available for error and input stream.

Christian
Re: Logging from Java Class [message #1730357 is a reply to message #1730137] Mon, 25 April 2016 09:29 Go to previous message
Daniel K. is currently offline Daniel K.Friend
Messages: 11
Registered: May 2012
Junior Member
Hi,
thanks for the hint.

Regards
Daniel
Previous Topic:Multiple enableFor ?
Next Topic:Running RCPTT scripts with EASE
Goto Forum:
  


Current Time: Thu Mar 28 08:11:13 GMT 2024

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

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

Back to the top