Win a copy of Java Concurrency Live Lessons this week in the Threads forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

System.out.println()  RSS feed

 
Joseph Sweet
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I wonder, when I do



in a servlet or any other class that runs on Tomcat, where does it print to by default? and how do I change that destination to some text file?
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 65833
134
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Depends upon the container and the OS. Tomcat or Resin on Windows for example, will print it to the console window. Under OS X, Tomcat writes it to $CATALINA_HOME/logs/catalina.out. And so on...

For greater control over logging output I'd suggest looking into the java.util.logging classes or the immensely popular Log4J package.
 
Joseph Sweet
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you, I will look at these suggestions.

By default, where does it write to when I use (now in a filter):



and how can I change that destination?
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For tomcat, it is under TOMCAT_HOME/logs/localhost_log.<date>
 
Joseph Sweet
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to do the following inside a doFilter() of a filter:



But the logs directory is just empty. Nothing is printed to there.

I am running the app on a remote Tomcat server. Did they change anything in the defualt log definitions and do you know how can I change it back?

Thank you for your help.
[ April 30, 2005: Message edited by: Joseph Sweet ]
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!