Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Tomcat 7 startup.bat opens in new window

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Saloon Keeper
Posts: 25467
180
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Rabindranath Bustos
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks, that did the trick.
 
Looky! I'm being abducted by space aliens! Me and this tiny ad!
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic