https://issues.apache.org/bugzilla/show_bug.cgi?id=48502

           Summary: Issue: Rotation file is not getting created -
                    RollingFileAppender
           Product: Log4j
           Version: 1.2
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: critical
          Priority: P2
         Component: Appender
        AssignedTo: [email protected]
        ReportedBy: [email protected]


log4j configuration in xml is as follows:
<log4j:configuration debug="true"
xmlns:log4j="http://jakarta.apache.org/log4j/"; >

<appender name="SYSLOGFILE" class="org.apache.log4j.RollingFileAppender">
    <param name="File"   value="temp.log" />
    <param name="Append" value="true" />
    <param name="MaxFileSize" value="5KB" />
    <param name="MaxBackupIndex" value="20" />
    <layout class="org.apache.log4j.PatternLayout">
      <param name="ConversionPattern" value="%d{DATE} %-5p %-15c{1} [%t][%x]:
%m%n"/>
    </layout>
  </appender>

....
<category ..
</log4j:configuration>

1. When messages are logged, temp.log is filled upto 5KB. 
2. When maxfilesize is  reached temp.1.log file needs to be created.
3. Subsequently temp.2 (3,4,5, ....etc).log files need to be created.

This is failing. Reason is file.renameTo(target) is failing. file is of type
java.io.File.

Proposed Solution:
Check if file.renameTo(target) has failed, by assigning it to a boolean
variable: boolean renameSucceeded = file.renameTo(target)
if(!renameSucceeded) { target.createNewFile(); copy(source,destination); }
make is synchronized for thread safety.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to