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