Translate

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

clear-host

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

$logOutputPath="$env:CATALINA_HOME"+"\logs\"

$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.