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 70447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T19:43:56+00:00 2026-05-10T19:43:56+00:00

Have Log4Net configured in our application to use a date stamped name and a

  • 0

Have Log4Net configured in our application to use a date stamped name and a 10Meg file size limit.
This automatically causes a rollover to a new file at midnight and whenever the 10Meg limit is reached. I would also like to roll over the logging to a new file each time the application is started (or closed).
Can I get all three roll over behaviours?

  • 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-10T19:43:57+00:00Added an answer on May 10, 2026 at 7:43 pm

    Set appendToFile to false in your config file.

    <appender name='RollingLogFileAppender' type='log4net.Appender.RollingFileAppender'> ....   <appendToFile value='false' /> .... </appender> 

    EDIT: To answer Craig’s comment:

    If you properly setup StaticLogFileName and CountDirection (see http://logging.apache.org/log4net/release/sdk/log4net.Appender.RollingFileAppender.html for more), then things roll as desired. We programmatically configure the logger in our app where we use this, but this is what the code looks like:

    Dim Layout As New PatternLayout('%date{yyyy-MM-dd HH:mm:ss,fff} [%-6thread] %-5level %type{2}.%method(%line) - %message%newline')  Dim Appender As New log4net.Appender.RollingFileAppender() Appender.File = Path.Combine(FileSystemHelper.LogDirectory, LogFileName) Appender.Layout = Layout Appender.AppendToFile = False ' we will start a new one when the program starts' Appender.Name = 'RollingLogFileAppender' Appender.Threshold = LogLevel() 'May want to set this by configuration' Appender.RollingStyle = log4net.Appender.RollingFileAppender.RollingMode.Size 'This means it will start a new log file each time the log grows to 10Mb' Appender.MaximumFileSize = '10MB' Appender.MaxSizeRollBackups = -1 'keep an infinite number of logs' Appender.StaticLogFileName = True Appender.CountDirection = 1 ' to reduce rollover costs' log4net.Config.BasicConfigurator.Configure(Appender) Appender.ActivateOptions() 
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

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

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

    • 7 Answers
  • Editorial Team

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

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • added an answer You can use string format codes in your ToString call. May 11, 2026 at 9:00 am
  • added an answer If you're using the ToString() method on a .NET boolean… May 11, 2026 at 8:59 am
  • added an answer To recreate the image you can use the method createRGBImage… May 11, 2026 at 8:59 am

Related Questions

Have Log4Net configured in our application to use a date stamped name and a
I have wrapped Log4net in a static wrapper and want to log loggingEvent.LocationInformation.MethodName loggingEvent.LocationInformation.ClassName
In logging frameworks like log4j & log4net you have the ability to log various
I need a logging framework in my application. I have two candidates: Log4Net and
Playing with log4net, I have seen the possibility to use a per-thread stack of
Currently I have the function CreateLog() for creating a a log4net Log with name
I'm a big fan of log4net , but recently, some (in my department) have
Have just started using Google Chrome , and noticed in parts of our site,
Have you ever seen any of there error messages? -- SQL Server 2000 Could
Have you guys had any experiences (positive or negative) by placing your source code/solution

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.