On Tue, Jun 28, 2016 at 11:15 AM, Navin Ipe
<[email protected]> wrote:
> Even if the logs get accumulated in the output stream, why would the program
> hang? I'd have assumed the OutputStream is on a separate thread.

That needs to be done by the caller i.e. program which is executing
the process. Have a look at [1]. Note it has nothing specific to
slf4j, it would happen with any code flow which writes to stdout

----
By default, the created subprocess does not have its own terminal or
console. All its standard I/O (i.e. stdin, stdout, stderr) operations
will be redirected to the parent process, where they can be accessed
via the streams obtained using the methods
getOutputStream(),getInputStream(), and getErrorStream(). The parent
process uses these streams to feed input to and get output from the
subprocess. Because some native platforms only provide limited buffer
size for standard input and output streams, **failure to promptly
write the input stream or read the output stream of the subprocess may
cause the subprocess to block, or even deadlock.**
----

For an example see PumpStreamHandler [2] from commons-exec which does
this properly.

Chetan Mehrotra
[1] https://docs.oracle.com/javase/7/docs/api/java/lang/Process.html
[2] 
https://github.com/apache/commons-exec/blob/trunk/src/main/java/org/apache/commons/exec/PumpStreamHandler.java
_______________________________________________
slf4j-user mailing list
[email protected]
http://mailman.qos.ch/mailman/listinfo/slf4j-user

Reply via email to