Log4net
  1. Log4net
  2. LOG4NET-234

RollingFileAppender generates incorrect file name

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Duplicate
    • Affects Version/s: 1.2.10
    • Fix Version/s: None
    • Component/s: Appenders
    • Labels:
      None
    • Environment:
      Windows XP, Windows 2003

      Description

      I have Appender defined as follow...

      <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender" >
      <file value="Logs\Log" /> <!-- Základní název souboru -->
      <appendtofile value="true" />
      <rollingstyle value="Date" /> <!-- Soubory budou vznikat na základě datumu/času logu -->
      <datepattern value="_yyyy-MM-dd.\tx\t"/> <!-- Maska pro název souboru (to .\tx\t tam musí být, aby byla přípona .txt)-->
      <StaticLogFileName value="false" /> <!-- Už první vzniklý soubor bude mít název obsahující datum. Jinak by logoval stále do jednoho stejného souboru a ten by v případě potřeby (změna datumu) přejmenoval -->

      <!-- Co a jak bude formátováno ve výstupu.
      Seznam všech dostupných %proměnných je na: http://logging.apache.org/log4net/release/sdk/log4net.Layout.PatternLayout.html
      Na stejné stránce dole je popsáno i co znamená to -5level apod. -->
      <layout type="log4net.Layout.PatternLayout">
      <conversionpattern value="%date [%-5level] - %message%newline"></conversionpattern>
      </layout>
      </appender>

      This Appender should generate file names like "Log_2009-10-15.txt", mostly it works fine, but in some unknown situations it generates file named "Log_2009-10-15.txt_2009-10-15.txt". It seems to me that this happens when there were no log-files and the incorrectly named file was the first log-file generated.

      1. logs.zip
        1.0 kB
        Alex Vilela

        Issue Links

          Activity

          Hide
          Dominik Psenner added a comment -

          Closing because it is a duplicate of LOG4NET-175

          Show
          Dominik Psenner added a comment - Closing because it is a duplicate of LOG4NET-175
          Show
          Stefan Bodewig added a comment - Probably related: http://stackoverflow.com/questions/579688/why-is-the-date-appended-twice-on-filenames-when-using-log4net
          Hide
          Alex Vilela added a comment -

          It looks like it is related to IIS web gardens!

          In our live environment we do have 3 worker processes in IIS hence the three log files. Changing this number had a direct effect in the number of log4net files generated.

          Show
          Alex Vilela added a comment - It looks like it is related to IIS web gardens! In our live environment we do have 3 worker processes in IIS hence the three log files. Changing this number had a direct effect in the number of log4net files generated.
          Hide
          Alex Vilela added a comment -

          The log files I mentioned on the previous post.

          Show
          Alex Vilela added a comment - The log files I mentioned on the previous post.
          Hide
          Alex Vilela added a comment -

          I experience the same behavior. I have an IIS web application and the log files become multiplied:

          datalog.2009.11.04.log
          datalog.2009.11.04.log.2009.11.04.log
          datalog.2009.11.04.log.2009.11.04.log.2009.11.04.log

          Unlikely LOG4NET-175 everything keeps working fine and never crashes.
          The file isn't really rolled out, I mean, one file is not a sequence of the previous one.
          Some logs happen on the first file, some on the second, then on the third, than log4net uses the first again and keep switching between the log files, therefore reading the logs is really hard.
          Please see attached log files.

          This is my configuration for the appender:
          <appender name="dataLog" type="log4net.Appender.RollingFileAppender,log4net">
          <param name="File" value="logs/datalog"/>
          <param name="AppendToFile" value="true"/>
          <param name="RollingStyle" value="Date"/>
          <param name="DatePattern" value=".yyyy.MM.dd.'log'"/>
          <param name="StaticLogFileName" value="false"/>

          <layout type="log4net.Layout.PatternLayout,log4net">
          <param name="ConversionPattern" value="%d [%t] %-5p %c.%M - %m%n"/>
          </layout>
          </appender>

          I'm using log4net 1.2.10.0

          Show
          Alex Vilela added a comment - I experience the same behavior. I have an IIS web application and the log files become multiplied: datalog.2009.11.04.log datalog.2009.11.04.log.2009.11.04.log datalog.2009.11.04.log.2009.11.04.log.2009.11.04.log Unlikely LOG4NET-175 everything keeps working fine and never crashes. The file isn't really rolled out, I mean, one file is not a sequence of the previous one. Some logs happen on the first file, some on the second, then on the third, than log4net uses the first again and keep switching between the log files, therefore reading the logs is really hard. Please see attached log files. This is my configuration for the appender: <appender name="dataLog" type="log4net.Appender.RollingFileAppender,log4net"> <param name="File" value="logs/datalog"/> <param name="AppendToFile" value="true"/> <param name="RollingStyle" value="Date"/> <param name="DatePattern" value=".yyyy.MM.dd.'log'"/> <param name="StaticLogFileName" value="false"/> <layout type="log4net.Layout.PatternLayout,log4net"> <param name="ConversionPattern" value="%d [%t] %-5p %c.%M - %m%n"/> </layout> </appender> I'm using log4net 1.2.10.0

            People

            • Assignee:
              Unassigned
              Reporter:
              Miroslav Vanicky
            • Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 24h
                24h
                Remaining:
                Remaining Estimate - 24h
                24h
                Logged:
                Time Spent - Not Specified
                Not Specified

                  Development