You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Alan Worstell <aw...@a-1networks.com> on 2013/01/24 01:33:11 UTC

Problems trying to disable log rotation within Tomcat 6

Hello,
I'm using Tomcat 6.0.24-2ubuntu1.10 on Ubuntu 10.04.4 and I am trying to 
disable datestamping and rotation of log files within Tomcat so I can 
use logrotate for everything.
I have added these lines to /etc/tomcat6/logging.properties:
1catalina.org.apache.juli.FileHandler.rotatable = false
2localhost.org.apache.juli.FileHandler.rotatable = false

 From what I have read, this will set those files to be written as 
prefix.suffix, rather than prefix.date.suffix as it does by default. 
However, when I reload Tomcat after setting this, it is creating:
catalina.2013-01-23.log
localhost.2013-01-23.log

Any assistance would be greatly appreciated.

Thanks,

-- 
Alan Worstell
A1 Networks - Systems Administrator
VTSP, dCAA, LPIC-1, Linux+, CLA, DCTS
(707)570-2021 x204
For support issues please email support@a-1networks.com or call 707-703-1050


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Problems trying to disable log rotation within Tomcat 6

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Alan,

On 1/23/13 7:33 PM, Alan Worstell wrote:
> Hello, I'm using Tomcat 6.0.24-2ubuntu1.10 on Ubuntu 10.04.4 and I
> am trying to disable datestamping and rotation of log files within
> Tomcat so I can use logrotate for everything. I have added these
> lines to /etc/tomcat6/logging.properties: 
> 1catalina.org.apache.juli.FileHandler.rotatable = false 
> 2localhost.org.apache.juli.FileHandler.rotatable = false
> 
> From what I have read, this will set those files to be written as 
> prefix.suffix, rather than prefix.date.suffix as it does by
> default. However, when I reload Tomcat after setting this, it is
> creating: catalina.2013-01-23.log localhost.2013-01-23.log
> 
> Any assistance would be greatly appreciated.

I'd be careful about trying to use logrotate with Tomcat: if you move
your log file, Tomcat will continue writing to it. If you
copy-and-truncate the file, you may end up losing logs in the time
between the start-of-copy and the end-of-truncate operation, or you
may end up losing *all* logs after the first rotation.

The reason Apache httpd works well with logrotate is because logrotate
sends a signal to httpd that says "reset your logs". That closes the
existing file descriptor (currently pointing to to a file that has
been moved out of the way) and opens a new one to the original path
name. Tomcat, JULI, log4j, etc. have no such mechanism and therefore
implement log rotation internally.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iEYEAREIAAYFAlEAjtgACgkQ9CaO5/Lv0PC/3QCfVGKJHDtvhXyX8dQufQvRvLfh
BtYAniLF4oF15uhXbJKyTJKQXmI75W9W
=RQHD
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Problems trying to disable log rotation within Tomcat 6

Posted by Konstantin Kolinko <kn...@gmail.com>.
2013/1/24 Alan Worstell <aw...@a-1networks.com>:
> Hello,
> I'm using Tomcat 6.0.24-2ubuntu1.10 on Ubuntu 10.04.4 and I am trying to
> disable datestamping and rotation of log files within Tomcat so I can use
> logrotate for everything.
> I have added these lines to /etc/tomcat6/logging.properties:
> 1catalina.org.apache.juli.FileHandler.rotatable = false
> 2localhost.org.apache.juli.FileHandler.rotatable = false
>
> From what I have read, this will set those files to be written as
> prefix.suffix, rather than prefix.date.suffix as it does by default.
> However, when I reload Tomcat after setting this, it is creating:
> catalina.2013-01-23.log
> localhost.2013-01-23.log
>

1. 6.0.24 is old and has known security issues
2. Support for "rotatable=false" is implemented in 6.0.33 and later
https://issues.apache.org/bugzilla/show_bug.cgi?id=49180
3. You can use java.util.logging.FileHandler in Tomcat logging in
exactly the same way as JULI FileHandler. Note that it has different
configuration options, see JDK docs for details.
4. I do not know whether "/etc/tomcat6/logging.properties" is the
correct file. It is up to you to check that it is actually used.

Best regards,
Konstantin Kolinko

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org