Some hotspot JVM flags, like -XX:+PrintCompilation
, cause output to appear on stdout or stderr. GC related output, such as that enabled by -verbose:gc, can be redirected using -Xloggc:<path>
, but I can't find any way to redirect other native output, other than by redirecting the entire process (which may be undesirable for certainly reasons, such as also capturing all System.out output).
+PrintCompilation uses print_on(tty, message)
, as can be seen from openjdk source, printing directly to tty, so I'd think redirecting the entire process output is your only option without recompiling the compiler.