> I'd like current messages to always be logged into a file > with the same name (e.g., mylogs.log).
To do this you need to set the file property to the 'static' log file name, and set the staticLogFileName property to true, e.g.: <file value="C:\\ProphIT_CTI\\mylogs.log" /> <staticLogFileName value="true" /> > When a file hits a > maximum size I'd like to have the file renamed and have > future logs go into a new file with the same name as before > (i.e., mylogs.log). This will happen if the staticLogFileName is set to true and the rollingStyle is Size or Composite. > The old file would be renamed to a name > that includes a sequence number and date (e.g., > mylogs20051109.2.log for today's second log file). It would > be OK if the date didn't get added to the name until the next day. > > The RollingFileAppender does this fine except that the > sequence number becomes the file extension. Currently the sequence number must be the last part of the filename, otherwise the appender cannot identify the previously rolled files. Nicko > Is there a way to configure the RollingFileAppender to do this? > > I'm currently using the following configuration: > > <appender name="Dev4RollingFile" > type="log4net.Appender.RollingFileAppender"> > <file value="C:\\ProphIT_CTI" /> > <maximumFileSize value="500KB" /> > <maxSizeRollBackups value="5" /> > <datePattern value="yyyy-MM-dd'.log'" /> > <staticLogFileName value="false" /> > <rollingStyle value="Composite" /> > <appendToFile value="true" /> > <countDirection value="0" /> > <layout type="log4net.Layout.XmlLayoutSchemaLog4j" /> > </appender> > > Thanks. > -- > Mike Blake-Knox >
