This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 138998 - ${netbeans.user}/var/log/messages.log rotation not working on Win32
Summary: ${netbeans.user}/var/log/messages.log rotation not working on Win32
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: -- Other -- (show other bugs)
Version: 6.x
Hardware: PC Windows XP
: P3 blocker (vote)
Assignee: Jesse Glick
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-04 06:03 UTC by andym
Modified: 2008-12-22 10:09 UTC (History)
0 users

See Also:
Issue Type: TASK
Exception Reporter:


Attachments
Solution Patch (619 bytes, patch)
2008-07-04 06:10 UTC, andym
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description andym 2008-07-04 06:03:13 UTC
Because java.io.File.renameTo() fails on Win32 if the destination already exists, the log file rotation as implemented
in core.startup/org.netbeans.core.startup.TopLogging does not work as intended. See the following JRE related Bug
Database entries for further details:

<http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4017593>
<http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4167147>

After the 3rd application startup, messages.1.log and messages.2.log will never be touched again. Also, the contents of
the recent messages.log file are lost on every application startup because the rotation fails silently and the
FileOutputStream is created with the append argument set to false.

The attached patch solves the problem by explicitly deleting messages.2.log in TopLogging.defaultHandler() before
renaming the remaining files.

Actually found in 6.0, but affecting all versions found in the Mercurial repository up to current.
Comment 1 andym 2008-07-04 06:10:57 UTC
Created attachment 63920 [details]
Solution Patch
Comment 2 Lukas Hasik 2008-07-04 07:50:21 UTC
increasing priority and reassigning to Jesse for evaluation (Yarda is on vacations)
Comment 3 Jesse Glick 2008-07-08 14:06:51 UTC
Applied as core-main #1cfcb19aa665. Thanks!
Comment 4 Quality Engineering 2008-07-10 04:13:32 UTC
Integrated into 'main-golden', available in NB_Trunk_Production #310 build
Changeset: http://hg.netbeans.org/main/rev/1cfcb19aa665
User: Jesse Glick <jglick@netbeans.org>
Log: #138998: log rotation broken on Win32.