JPPF, java, parallel computing, distributed computing, grid computing, parallel, distributed, cluster, grid, cloud, open source, android, .net
JPPF

The open source
grid computing
solution

 Home   About   Features   Download   Documentation   On Github   Forums 
June 03, 2023, 05:05:37 PM *
Welcome,
Please login or register.

Login with username, password and session length
Advanced search  
News: New users, please read this message. Thank you!
  Home Help Search Login Register  
Pages: [1]   Go Down

Author Topic: standard output of task  (Read 1585 times)

cm

  • JPPF Master
  • ***
  • Posts: 38
standard output of task
« on: April 08, 2014, 05:36:41 PM »

Hi Laurent,

when I run a node on windows (by startNode.bat) then I can see the output of the tasks which are running on this node in the cmd window.
On Linux I start the node with the JPPFNode wrapper. Is there a posibility to see or log the output of the tasks which are running in this node?
I need it for debugging.

Thanks
Christian
Logged

lolo

  • Administrator
  • JPPF Council Member
  • *****
  • Posts: 2272
    • JPPF Web site
Re: standard output of task
« Reply #1 on: April 09, 2014, 07:16:37 AM »

Hello CHristian,

I thought the node output was automatically logged in the wrapper's log file (wrapper-node.log file), isn't it the case?
If not, one possibiilty is to use a node initialization hook to redirect System.out and System.err to files, as follows:

Code: [Select]
public class OutputRedirectHook implements InitializationHook {
  @Override
  public void initializing(final UnmodifiableTypedProperties initialConfiguration) {
    try {
      PrintStream out = new PrintStream("stdout.log");
      PrintStream err = new PrintStream("stderr.log");
      System.setOut(out);
      System.setErr(err);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}

Note that this will be a new feature in JPPF 4.1, which will allow you to specify the redirection directly from configuration properties. See JPPF-214 Ability to redirect std and err output for nodes and drivers for reference.

Sincerely,
-Laurent
Logged

boris.klug

  • JPPF Master
  • ***
  • Posts: 41
Re: standard output of task
« Reply #2 on: April 09, 2014, 08:49:30 AM »

Hi Christian,

here are my ideas for debugging the tasks:

1) Use a logging framework like log4j. With such a framework you can configure where the output should go: To a (local) file, to the client (using JMX, see the JPPF user manual) or even to a database.

2) Do no output at all: When an exception occurs, set the exception in the result and output/examin the exception in your client program. This is more for the normal operation of the program, not for debugging.
Logged
Pages: [1]   Go Up
 
JPPF Powered by SMF 2.0 RC5 | SMF © 2006–2011, Simple Machines LLC Get JPPF at SourceForge.net. Fast, secure and Free Open Source software downloads