pyjnius icon indicating copy to clipboard operation
pyjnius copied to clipboard

Reading java output messages

Open ismailsimsek opened this issue 2 years ago • 1 comments

while doing unit test, is there a way to read java execution output/log messages from python? im trying to use following code to read stdout but its empty.

f = io.StringIO()
with contextlib.redirect_stdout(f):
    ...pyjnius execution...
print(f.getvalue())

using pyjnius with this project https://github.com/memiiso/pyliquibase

ismailsimsek avatar Sep 04 '21 19:09 ismailsimsek

See https://github.com/terrier-org/pyterrier/blob/master/pyterrier/bootstrap.py#L214 This allows Java System.out.println() etc to be redirected to a Jupyter console. I think you could use similar code to redirect to a buffer.

cmacdonald avatar Sep 05 '21 08:09 cmacdonald

No reply after 2 years. Closing as can't repro.

Julian-O avatar Oct 27 '23 06:10 Julian-O