You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jonathan Mast <jh...@gmail.com> on 2009/03/18 20:09:26 UTC

Access log behavior

We're using the AccessLogValve extensively and I'm wondering if anyone can
tell me what happens when an active (ie. today's) access log file is
deleted?

Will Tomcat handle this gracefully or go bonkers?

I occasionally delete some log files that are active but are unimportant,
when that happens i restart Tomcat just to be safe but I'd rather not have
to do this.

My setup is:
Linux
Java 1.4.2
Tomcat 5.5.17

Re: Access log behavior

Posted by André Warnier <aw...@ice-sa.com>.
Jonathan Mast wrote:
> We're using the AccessLogValve extensively and I'm wondering if anyone can
> tell me what happens when an active (ie. today's) access log file is
> deleted?
> 
> Will Tomcat handle this gracefully or go bonkers?
> 
Well, did you try ? does it, like, go bonkers ?

In a general sense, I don't think you should really do that though, 
there must be better/safer ways.
But starting that discussion is likely to lead us into a discussion of 
Tomcat logging, which is a delicate subject on this list.
A bit like chaos theory : how the fluttering of a butterfly's wing in 
the Amazon can cause a tornado in the Midwest..

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


RE: Access log behavior

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: André Warnier [mailto:aw@ice-sa.com] 
> Subject: Re: Access log behavior
> 
> how is that space reclaimed when the application finally 
> closes the file ?  Is that automatic, or does one need 
> to run an fsck or the like to really reclaim that space ?

It's automatic.  The disk allocation is either part of or linked to from the inode; the file system makes such space available when both the link count and busy count on a regular file inode go to zero.  Only if the system crashes and you're using a non-journaling file system (e.g., ext2, FAT32) would you need to run fsck.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

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


Re: Access log behavior

Posted by André Warnier <aw...@ice-sa.com>.
Caldarale, Charles R wrote:
> 
> Although the paths to the files are no longer accessible, the disk space they're consuming won't go away until you do the restart.
> 
While this is a bit [OT] probably, how does that work ?  I mean, if the 
directory entry is deleted, but the original application keeps the file 
open and keeps writing, then how is that space reclaimed when the 
application finally closes the file ?  Is that automatic, or does one 
need to run an fsck or the like to really reclaim that space ?


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


RE: Access log behavior

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Jonathan Mast [mailto:jhmast.developer@gmail.com] 
> Subject: Access log behavior
> 
> I'm wondering if anyone can tell me what happens when an 
> active (ie. today's) access log file is deleted?

There's not really any such thing as "delete" in Linux.  When you do an rm, all that happens is an unlink() of whatever path points to the inode of interest.  If the inode is still busy (e.g., an open() has been done on *any* path to the inode and a close() has not been done on the returned handle), the inode will continue to exist and support I/O requests.

> Will Tomcat handle this gracefully or go bonkers?

Tomcat won't know it happened.  Whether or not the logger you're using does depends on if the logger keeps the file opened (most do), or closes and reopens it periodically.

> when that happens i restart Tomcat just to be safe but I'd 
> rather not have to do this.

Although the paths to the files are no longer accessible, the disk space they're consuming won't go away until you do the restart.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.

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