I need to understand how Tomcat is able to catch JVM garbage collection console output logs and put it in catalina.out.
I tried to redirect System.out and System.err, but no can do. I was not able to get the output of GC logs.
However, when activating -verbose:gc in Tomcat (in catalina.sh, *JAVA_OPT*) and later cheking the output in catalina.out I was able to see the GC logs. How is this possible?
How was Tomcat able to redirect that output to a file?
Maybe do you know any way to redirect the GC log output inside some java application using java code?
Thank you in advance.