1

I am trying to roll the log catalina.out on a webserver using logrotate. I have been able to roll the log and a log catalina.out-dateext is created. But I notice that the log is being written in the new file catalina.out-dateext. Is there something that need to be done on the webserver?

Thank you

talonx
  • 1,762
  • 1
  • 15
  • 33
Shann
  • 660
  • 1
  • 6
  • 19
  • what have you written in /etc/logrotate.d/tomcat, what I feel is you want to say that current log is being written to catalina.out-datext and also to catalina.out or not. – linux_fanatic Sep 19 '13 at 07:33
  • hi, /home/Tomcat/logs/catalina.out { daily rotate 7 missingok create 0644 tomcat tomcat dateext } i did not put the file in /etc/logrotate.d/ instead i put the file in another directory and then from java i execute the commad: /usr/sbin/logrotate /etc/pex/tomcat the log is rolled to catalina.out-20130919 and catalina.out is 0kb. but the log is being written to the catalina.out-20130919 instead of catalina.out. – Shann Sep 19 '13 at 09:05
  • Use copytruncate option – truncates the original log file in place after creating a copy, instead of moving the old log file and optionally creating a new one, It can be used when some program can not be told to close its logfile and thus might continue writing (appending) to the previous log file. – linux_fanatic Sep 19 '13 at 09:18
  • add copytruncate in your /etc/pex/tomcat file.For more info about all the options http://www.vineetmanohar.com/2010/03/howto-rotate-tomcat-catalina-out/ – linux_fanatic Sep 19 '13 at 09:19
  • Thank you... it worked. Thank you very much :) – Shann Sep 19 '13 at 09:36
  • Hi can you please upvote my comment then :) if it worked for you. adding as an answer might be helpful for anyone. – linux_fanatic Sep 19 '13 at 09:43

1 Answers1

3

Add copytruncate in your /etc/pex/tomcat file. For more info about all the options: vineetmanohar.com/2010/03/howto-rotate-tomcat-catalina-out

Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820
linux_fanatic
  • 4,767
  • 3
  • 19
  • 20