Tuesday, December 9, 2014

Redirect tomcat console log output to a file

1>Set the environment variable CATALINA_HOME to point to whereever your tomcat is installed. For me that was C:\Program Files\apache-tomcat-7.0.55

2>Save the script below as a *.ps1


$catalinaBat = $env:CATALINA_HOME+"\bin\catalina.bat"


$logOutputFile= "catalina.out"

set-location "$logOutputPath"

Start-Process -FilePath "$catalinaBat" -ArgumentList "run > $logOutputFile  2>&1"

write-host "Your tomcat log is being written out to "$logOutputPath$logOutputFile

This script will run launch tomcat and write the output to a file.