[jboss-jira] [JBoss JIRA] Created: (JBAS-6361) log write to server.log does not append to the file as expected

Calin Medianu (JIRA) jira-events at lists.jboss.org
Mon Jan 5 04:16:54 EST 2009


log write to server.log does not append to the file as expected
---------------------------------------------------------------

                 Key: JBAS-6361
                 URL: https://jira.jboss.org/jira/browse/JBAS-6361
             Project: JBoss Application Server
          Issue Type: Bug
      Security Level: Public (Everyone can see)
    Affects Versions: JBossAS-5.0.0.GA
         Environment: Linux 2.6 intel, java 1.6
            Reporter: Calin Medianu


When I truncate the server.log file (in my case jboss/server/default/log/server.log) the server continues to write at the old offset. This is most likely because the file is not open in append mode.

The expected behaviour in unix is that when a file is truncated, using the command:
> server.log
for instance, the file size is reduced to zero. What happens with jboss is that a file with a hole is created:

[jboss at tm03 ~]$ ls -l jboss/server/default/log/server.log
-rw-rw-r-- 1 jboss jboss 1840433 Jan  5 01:08 jboss/server/default/log/server.log
# I truncate the file
[jboss at tm03 ~]$ > jboss/server/default/log/server.log
[jboss at tm03 ~]$ ls -l jboss/server/default/log/server.log
-rw-rw-r-- 1 jboss jboss 0 Jan  5 01:09 jboss/server/default/log/server.log
# the file is size 0 as expected
[jboss at tm03 ~]$ ls -l jboss/server/default/log/server.log
-rw-rw-r-- 1 jboss jboss 1841656 Jan  5 01:10 jboss/server/default/log/server.log
[jboss at tm03 ~]$ ls -s jboss/server/default/log/server.log
12 jboss/server/default/log/server.log
# The file has jumped to the reported size of 1841656 but actual size of 12 when the logwriter wrote 12 bytes, but at the old offset of 1840433 

This makes it impossible to truncate logs while the server is running.



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the jboss-jira mailing list