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

  • SEARCH
  • Home
  • 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 7857271
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T20:59:18+00:00 2026-06-02T20:59:18+00:00

Im trying to create a log file using log4net. I have it create a

  • 0

Im trying to create a log file using log4net.
I have it create a log file. But i can’t get the name of the log file to be the current date.

I have tried this:

<file value="log\\$date.txt"/>

But this just leans me with a file called “$date.txt” in the log folder.
I would like the file to be named “25-04-2012.txt”

Anyone know the little trick to make this work?

  • 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-02T20:59:19+00:00Added an answer on June 2, 2026 at 8:59 pm

    From the documentation, you should use a RollingFileAppender

    This example show how to configure the RollingFileAppender to roll log
    files on a date period. This example will roll the log file every
    minute! To change the rolling period adjust the DatePattern value. For
    example, a date pattern of “yyyyMMdd” will roll every day. See
    System.Globalization.DateTimeFormatInfo for a list of available
    patterns.

    <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
        <file value="logfile" />
        <appendToFile value="true" />
        <rollingStyle value="Date" />
        <datePattern value="yyyyMMdd-HHmm" />
        <layout type="log4net.Layout.PatternLayout">
            <conversionPattern value="%date [%thread] %-5level %logger [%property{NDC}] - %message%newline" />
        </layout>
    </appender>
    

    Documentation (search for rollingFileappender)

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

Sidebar

Related Questions

I am trying to create 2 log files using log4j using this configuration: log4j.rootLogger=debug,stdout,logfile
I'm trying to create a new log file every hour with the following code
I am trying to create a simple log in system that uses ajax but
I'm trying create a bot which automatically likes Facebook posts. Using Mechanize I can
js.I am trying to create a file upload using node.js and mongodb.I am getting
Using VB.NET, I am trying to create a text file if it doesn't exist
I am trying to create a file inside a directory using the following code:
I'm trying to load a file using webrequest method. First I need to log
I'm facing a problem when trying to log my application using log4net. My application
I'm trying to create a C# console application that will generate a log file.

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.