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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T20:40:04+00:00 2026-06-07T20:40:04+00:00

log4net in my project creates new log file every minute. I would like to

  • 0

log4net in my project creates new log file every minute. I would like to have just one file per instance of my application, but every instance that runs should create new log file.

This is from my app.config file:

<appender name="file" type="log4net.Appender.RollingFileAppender">
  <file value="C:\\Logs\\log2_"/>
  <rollingStyle value="Date"/>
  <datePattern value="MMdd_HHmmss.\tx\t"/>
  <staticLogFileName value="false"/>
  <appendToFile value="true"/>
  <maximumFileSize value="500MB"/>
  <layout type="log4net.Layout.PatternLayout">
    <conversionPattern value="%date %-5level %message%newline"/>
  </layout>
</appender>

What is the error here?

  • 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. Editorial Team
    Editorial Team
    2026-06-07T20:40:06+00:00Added an answer on June 7, 2026 at 8:40 pm

    Your rolling style is set to Date meaning it will rotate on a time based interval. The datePattern element appears to be misused but it set to roll every minute (the ./tx/t) seem extraneous.

    From the documentation the following is the example for once per app instance (with a 50G hard limit):

    <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
        <file value="logfile.txt" />
        <appendToFile value="false" />
        <rollingStyle value="Size" />
        <maxSizeRollBackups value="-1" />
        <maximumFileSize value="50GB" />
        <layout type="log4net.Layout.PatternLayout">
            <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
        </layout>
    </appender>
    

    See here for the documentation

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

Sidebar

Related Questions

I have two projects configured identically for log4net. One project logs fine; however, the
Using log4net we would like to log all calls to our ASP.NET MVC controller
I use log4net in just about every code project. I was wondering what other
I have a console project that I have been working on. I added log4net
I am using log4net and would like to set up a process to notify
I have a project that uses log4net and works fine on the developer machines.
I am developing a asp.net project and I dont have very long web.config file
In a project, i'm using log4net to write down in the event log. I
I have my log4net Wrapper and log4net dll in its own class project and
I have a .nuspec file for my project, which references a third-party DLL that

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.