Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 168683
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T12:29:47+00:00 2026-05-11T12:29:47+00:00

I have a Log4Net RollingFileAppender that is configured as: <configuration> <configSections> <section name=log4net type=log4net.Config.Log4NetConfigurationSectionHandler,

  • 0

I have a Log4Net RollingFileAppender that is configured as:

<configuration>    <configSections>     <section name='log4net' type='log4net.Config.Log4NetConfigurationSectionHandler, log4net'/>   </configSections>    <log4net>      <root>       <level value='ALL' />     </root>      <logger name='RollingFileAppender' additivity='false'>       <level value='DEBUG'/>       <appender-ref ref='RollingFileAppender' />     </logger>      <appender name='RollingFileAppender' type='log4net.Appender.RollingFileAppender' >       <param name='File' value='C:\\MyLog.log' />       <param name='AppendToFile' value='true' />       <param name='DatePattern' value='yyyy-MM-dd'/>       <layout type='log4net.Layout.PatternLayout'>         <param name='ConversionPattern' value='%m%n'/>       </layout>     </appender>    </log4net>  </configuration> 

Looking at the documentation, the The default rolling style is Composite, so it makes sense this will roll when it reaches a certain size (the default of 10MB), not just on the date.

The problem is when it hits the size, it is restarting the log and I am losing the data from the first half of the day (it reaches this size around noon).
Why wouldn’t this just roll to a new file and all future log lines are put into the MyLog.log? Or is it the log is rolling, but then at midnight, it is rolling again and overwritting the dated log (eg. rolling to MyLog.log2009-04-08 once it reaches 10MB, and then overwritting this same file at midnight)?

I will set the

<rollingStyle value='Date' /> 

Is this all I have to do to ensure it only rolls on the Date boundary? Can I change this on the fly in the Log4Net.config, or do I have to restart the application? It is running on IIS6.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. 2026-05-11T12:29:48+00:00Added an answer on May 11, 2026 at 12:29 pm

    Here’s my settings. It rolls only on date:

    <log4net>     <appender name='RollingFile' type='log4net.Appender.RollingFileAppender'>         <file value='c:\Logs\Today.log'/>         <rollingStyle value='Date'/>         <datePattern value='yyyyMMdd'/>         <appendToFile value='true'/>         <layout type='log4net.Layout.PatternLayout'>             <conversionPattern value='%level %logger %date{ISO8601} - %message%newline'/>         </layout>     </appender>     <root>         <!-- Options are 'ALL', 'DEBUG', 'INFO', 'WARN', 'ERROR', 'FATAL' and 'OFF'. -->         <level value='ERROR'/>         <appender-ref ref='RollingFile'/>     </root> </log4net> 

    Changes to your web.config, will restart the application automatically (so you’ll lose sessions, etc).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 323k
  • Answers 323k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer This article provides chat development tutorial using c#. May 14, 2026 at 1:01 am
  • Editorial Team
    Editorial Team added an answer read can parse a string into float and int: Prelude>… May 14, 2026 at 1:01 am
  • Editorial Team
    Editorial Team added an answer Ok, I think I've worked out what's going on -… May 14, 2026 at 1:01 am

Related Questions

Right now, I'm programmatically configuring log4net by creating a RollingFileAppender instance then calling BasicConfigurator.Configure().
I am configure log4net to use a composite RollingFileAppender so that the current file
I want my logfile to look something like this: 2009-02-13.log but the problem is
We are using log4net to create our logfiles from Windows services, and we are

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.