Subject: | java console output redirect in Shared Mode (feature request) |
Date: | Thu, 06 Dec 2007 17:02:04 +0000 |
To: | bug-Inline-Java [...] rt.cpan.org |
From: | Martin Friebe <martin [...] hybyte.com> |
It is possible for the java VM (or the java code running in it) to write
to STDOUT / STDERR
If Java Inline is used in non-shared mode (without SHARED_JVM) those
msgs go to the same STDOUT/ STDERR as the calling perl application.
If using SHARED_JVM, this output is lost.
It could at least be redirected to a configurable file. This could
easily be one in
package Inline::Java::JVM ;
my $cmd =
Inline::Java::Portable::portable("SUB_FIX_CMD_QUOTES", "\"$java\" $args
org.perl.inline.java.InlineJavaServer $debug $this->{bind} $this->{port}
$shared $priv $native_doubles") ;
Inline::Java::debug(2, $cmd) ;
Change to
my $cmd =
Inline::Java::Portable::portable("SUB_FIX_CMD_QUOTES", "\"$java\" $args
org.perl.inline.java.InlineJavaServer $debug $this->{bind} $this->{port}
$shared $priv $native_doubles 2>&1 >>$log_file ") ;
Inline::Java::debug(2, $cmd) ;
The value for $log_file would have to be passed in via the argument to
import (use Inline Java => xxx, LOG_FILE => 'logfile')
The value could either default to /dev/null, or if not present the
redirect operator (">>") must not be present neither.
Tested on FreeBSD
Thanks
Martin