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

            Bug ID: 55621
           Summary: org.apache.log4j.RollingFileAppender  Log in rotated
                    file as well as the current file
           Product: Log4j
           Version: 1.2
          Hardware: Other
                OS: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Appender
          Assignee: log4j-dev@logging.apache.org
          Reporter: addk...@gmail.com

Hi, We have configured log4j as below where we specify to rotate file once it
reach 500 MB size.   The file is getting rotated but we are seeing wired thing.

Once the first file rotate to my.log.1 our application write few logs to my.log
and few in my.log.1 .

later when the file rotate n the first file is rename to my.log.2 as expected
but my application now writes to my.log.2 and my.log.

This continues to write to the first file and the current file  until my first
created file complete the rotation and is deleted. Once the cycle is complete
my application writes to only single current log file as specified.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration PUBLIC "-//LOGGER" "log4j.dtd">

<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/";>

        <!-- Appenders -->
        <appender name="console" class="org.apache.log4j.ConsoleAppender">
                <param name="Target" value="System.out" />
                <layout class="org.apache.log4j.PatternLayout">
                        <param name="ConversionPattern" value="%d %-5p: %c -
%m%n" />
                </layout>
        </appender>

        <appender name="file" class="org.apache.log4j.RollingFileAppender">
                <param name="maxFileSize" value="500MB" />
                <param name="maxBackupIndex" value="5" />
                <param name="Append" value="true"/>
                <param name="File" value="/usr/local/tomcat6/logs/my.log" />
                <layout class="org.apache.log4j.PatternLayout">
                        <param name="ConversionPattern" value="%d [%t] %-5p %c
- %m%n" />
                </layout>
        </appender>

        <!-- Application Loggers -->
        <logger name="com.bestbuy.my" additivity="true">
                <level value="INFO" />
        </logger>

        <logger name="org.springframework" additivity="true">
                <level value="WARN"/>
        </logger>

        <logger name="org.hibernate" additivity="true">
                <level value="WARN"/>
        </logger>

        <logger
name="org.springframework.web.filter.CommonsRequestLoggingFilter"
additivity="true">
                <level value="WARN" />
        </logger>

        <!-- Root Logger -->

        <root>
                <priority value="INFO" />
                <appender-ref ref="file" />
        </root>

</log4j:configuration>

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: log4j-dev-unsubscr...@logging.apache.org
For additional commands, e-mail: log4j-dev-h...@logging.apache.org

Reply via email to