Hello. I'm new to deploying in tomcat, and I'm facing some problems trying to install tomcat 7 in a Windows computer.
I could install and start tomcat without problems (the zip distribution from apache.org). However, due to some requirements I can't start it as a service.
I read in a lot of places that I can start it with >catalina start, which would start apache in the background and redirect the output to the log files. However, what's happening is that it starts the server in a new window, and the output is printed to console and not saved to any log file.
I would like to know if I'm missing some additional configuration, or any tips on the subject.
Tomcat's console is not actually a log file, just the stdout and stderr output from the Tomcat JVM. The stock scripts for running Tomcat usually redirect it to catalina.out, but that's just a convention and not actually an architectural constraint. Which is one reason why we tell people that webapps should do system.out.println - you never know where the print output may be sent.
So you should be able to create a "log file" by starting Tomcat with a "catalina start >C:\TOMCAT_HOME\logs\catalina.out" (adjust path to fit your preferences). Since the pop-up window is provided by Windows, if you redirect both stdout and stderr ("2>"), Windows shouldn't pop up that second window, since it's only provided when a stdio output needs a place to present itself.
There are other ways of running commands in Windows that avoid the second window as well, but I'm out of practice on them.
An IDE is no substitute for an Intelligent Developer.
Joined: Jul 24, 2012
Thanks for your response.
I've already tried to redirect stdout and stderr but it doesn't work. I also tried to edit the catalina.bat file itself and add the redirection parameters right at the command invocation but the result is the same: the additional window keeps poping up with all the output being shown there and the log files are left empty.
Btw, I do use log4j as logging framework, but just using the console appender because I want to see the output in eclipse and no log files while in development and didn't wanted to have to change the configuration specifically for production, so I assumed that the appserver would take care of the redirection. I'm open for suggestions if there are alternative ways to achieve that (log output in console for development but to a file in production).