Win a copy of Design for the Mind this week in the Design forum!
    Bookmark Topic Watch Topic
  • New Topic

How to clear log files?

 
Nitin Jawarkar
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hello,

There are log files in /tomcat/logs/ directory what happen whenever i hit page then datewise log file is created and also the size of catalina.out file is increase acoording to hit page, due to this my server take extra space for this, so is there any solution that log file will not generate everytime.

Thanx
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
Which file is growing? If it's an access log, then that's what it's supposed to do. If it's catalina.out, std.out, err.out, or something similar, each entry is due to a System.out.println(), e.printStackTrace() or similar in your code. Remove those and the output will stop.

Logging has changed over time in Tomcat. Which version are you using, what OS and, if Windows, is it installed as a service? Also, what exactly are the names of the files in the logs directory.
Answer these and I can probably help you quiet them down.
 
Nitin Jawarkar
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Report post to moderator
thanx,

I m using Tomcat 5.0.27 and OS is windows-98 and files generated are date wise in logs directory means for each date it generate one log file, similar catalina.out size also increase same time so for this what shoul i do to prevent them.
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
I think the best thing to do in your case is go through the code and get rid of the System.out.println calls.

Also, I recommend looking into log4j. http://logging.apache.org/log4j.
You can configure it to log as much or as little as you want.

System.out.println is fine for small trivial apps and prototypes. Anything more than that requires a real logger.
 
Nitin Jawarkar
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Report post to moderator
Thanx,

I have change my log4j file according now it run better.

Thanx
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Report post to moderator
I'm glad it's working for you.

It would have been helpful if you had mentioned that you were using log4j in your initial question. ;-)
 
suman deb
Ranch Hand
Posts: 54
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi,

I have a question related to this topic. I am using tomcat 5.0.27 and my catalina.out is not cleaned/rollup and the size became around 1gb. Is there any way so that catalina.out will be cleaned automatically? Is there any property in logger.properties or server.xml which I can use?

Thanks
Suman
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64715
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not post the same question more than once.
 
    Bookmark Topic Watch Topic
  • New Topic