Is it possible to capture Java's stdout/stderr?

81 views
Skip to first unread message

Alan Brogan

unread,
Feb 27, 2015, 12:24:42 PM2/27/15
to pyjni...@googlegroups.com
Thank you for pyjnius

I have been successfully using it to write Python scripts which call a (proprietary) Java API. No problems so far, but one minor annoyance: whenever I initialize their API they send a lot of info to stdout which gets lost because (in production) the script is run on a headless server. Similarly, when I cause a crash in their API the stack dump  gets written to Java's stderr and also lost.

So far I've been working around this by running from a top level bash script and redirecting at that level, but that loses context - e.g. for a stackdump I get the Java trace in one log, and the subsequent Python traceback in another.

I'd much prefer to capture Java's stdout/err from within the Python script and send it to my normal Python logging. Is this possible?

Mathieu Virbel

unread,
Feb 27, 2015, 12:32:12 PM2/27/15
to pyjni...@googlegroups.com
Hi,

I always wanted to try it, but never got time / usage for.

So somewhere, you might have API too to access it. Feel free to share your end result :)

Mathieu

--
You received this message because you are subscribed to the Google Groups "PyJNIus development ML" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyjnius-dev...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages