aspose file tools*
The moose likes Tomcat and the fly likes Tomcat 7 startup.bat opens in new window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat 7 startup.bat opens in new window" Watch "Tomcat 7 startup.bat opens in new window" New topic
Author

Tomcat 7 startup.bat opens in new window

Rabindranath Bustos
Greenhorn

Joined: Jul 24, 2012
Posts: 3
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.

Regards,

Rabindranath
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16145
    
  21

Welcome to the JavaRanch, Rabindranath!

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
Rabindranath Bustos
Greenhorn

Joined: Jul 24, 2012
Posts: 3
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).

Thanks in advance.
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12806
    
    5
I don't know about Tomcat 7, but the Tomcat 6 catalina.bat contains the following:



SO - it looks like using "start" is what causes the new window, I suggest you try "run"

Bill
Rabindranath Bustos
Greenhorn

Joined: Jul 24, 2012
Posts: 3
Thanks, that did the trick.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tomcat 7 startup.bat opens in new window