In a multithreaded Java program, does each thread have its own copy of System.out?

前端 未结 5 1536
我寻月下人不归
我寻月下人不归 2020-12-06 10:36

I\'m writing a multithreaded Java program where each thread potentially needs its standard output redirected to a separate file. Each thread would have its own file. Is it p

5条回答
  •  时光取名叫无心
    2020-12-06 11:31

    Is it possible to redirect System.out on a "per-thread" basis

    You can redirect them all to your delegate which will be responsible for 'per-thread' logic.

    Here is example of parallel JBehave tests having theirs own file output.

提交回复
热议问题