Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 04-10-2008
mefoster mefoster is offline
Registered User
 
Name: Mary Ellen Foster
Organization: Technical University of Munich
Project: JAST human-robot dialogue system
 
Join Date: Jun 2006
Posts: 77
How does stderr/stdout redirection work?

One of the Ice servers in the system I'm currently working on is a weird Java/SWI-prolog hybrid. If I redirect the output from that server using any of the Ice redirection properties (e.g., IceGrid.Node.Output), only the messages that are printed from the Java side show up in the logs; the messages that are directly printed by Prolog seem to vanish into the ether somehow.

If I run the program from the command line, using exactly the same executable values and environment as in Ice and with output redirection, I get the full output in the files. I mean, I do something like this (where "pl" is the Prolog executable; using a bash shell on linux):
Quote:
pl main.pl -g run 1>test.out 2>test.err
and test.out and test.err contain everything printed by the server. But if I redirect through IceGrid, the corresponding files contain only the output produced by the Java side.

Is there anything obvious I should check to see what's going on here?

Thanks,

MEF
__________________
Mary Ellen Foster
Technical University of Munich
JAST human-robot dialogue system
Maintainer of Fedora Ice packages
Reply With Quote
  #2 (permalink)  
Old 04-10-2008
benoit's Avatar
benoit benoit is offline
ZeroC Staff
 
Name: Benoit Foucher
Organization: ZeroC, Inc.
Project: Ice
 
Join Date: Feb 2003
Location: Rennes, France
Posts: 1,431
Hi,

IceGrid uses the Ice.StdErr and Ice.StdOut properties to redirect the server output. The standard error/output is redirected by the server Ice communicator when it's initialized (with the java.lang.System.setOut/setErr methods). I suspect your prolog JNI library continues to log to the old stdout/stderr instead of using the new standard output/error.

One solution to get this working would be the write a small wrapper to redirect stderr/stdout and then spawn the Java process. IceGrid would use this wrapper instead of directly using the java executable.

Cheers,
Benoit.
Reply With Quote
  #3 (permalink)  
Old 04-11-2008
mefoster mefoster is offline
Registered User
 
Name: Mary Ellen Foster
Organization: Technical University of Munich
Project: JAST human-robot dialogue system
 
Join Date: Jun 2006
Posts: 77
Quote:
Originally Posted by benoit View Post
IceGrid uses the Ice.StdErr and Ice.StdOut properties to redirect the server output. The standard error/output is redirected by the server Ice communicator when it's initialized (with the java.lang.System.setOut/setErr methods). I suspect your prolog JNI library continues to log to the old stdout/stderr instead of using the new standard output/error.
Yes, it looks like that was the issue. Unfortunately, the way this application is written, it's not really practical to use a wrapper -- the main program is actually written prolog, and it initiates the Ice connection through Java after it's done its own initialisation.

For posterity, here's the solution I'm now using to capture all redirected output: after the Ice communicator has been initialised (in Java), I test whether the Ice.StdErr and/or Ice.StdOut properties exist. If they do, then I explicitly redirect the stderr and stdout in Prolog to files with similar names to the Ice files. (I originally thought of just redirecting prolog stdout to the *same* files, but that's probably a recipe for corrupting the output ...)

MEF
__________________
Mary Ellen Foster
Technical University of Munich
JAST human-robot dialogue system
Maintainer of Fedora Ice packages
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
dumpdb output to STDERR? ctennis Comments 0 09-07-2007 03:07 PM
icegridadmin.exe/IceGridGUI.jar 3.2b retrieve stdout/err bug mpugach Bug Reports 1 03-05-2007 03:25 AM
Multiple Layers of Redirection in IceGrid zhi Help Center 1 11-22-2006 04:28 AM
My Ice Stats doesn't work?? billwillman Help Center 6 10-03-2006 11:46 PM
This should work! catalin Help Center 3 12-11-2003 03:24 PM


All times are GMT -4. The time now is 07:49 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.