4

I'm using a native DLL library with JNA.
This library outputs (via printf or cout I suppose) some stuff in my java console that I don't want to see.
The library is provided by someone else and I can't modify it.

My java application also print some stuff in the console (with a logger), that I want to see there.

Is there a way to disable the native library output, or even better to route this output to a file ?

lmo
  • 497
  • 5
  • 23
  • 1
    Have you checked [this](http://stackoverflow.com/questions/17935474/ndk-how-to-remove-log-debug-statements-on-release)? – John K Mar 04 '16 at 10:32
  • 1
    Since you are using a logger try to redirect stdout and stderr to the logger (or a logger) as well. Then you should be able to redirect or suppress it. How exactly this is done depends on the actual logging framework you use. (Something like that might work: http://stackoverflow.com/questions/1982927/send-jni-c-stderr-stdout-through-log4j) – Thomas Mar 04 '16 at 10:34

1 Answers1

0

Are you using your own library or library provided by someone else? If you are the owner of the library, then this might help. How to disable cout output in the runtime?

Community
  • 1
  • 1
Anand Vaidya
  • 1,374
  • 11
  • 26