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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:54:29+00:00 2026-05-26T19:54:29+00:00

my FileAppender isn’t working. It probably isn’t a permissions thing as I’m local admin.

  • 0

my FileAppender isn’t working. It probably isn’t a permissions thing as I’m local admin.

I’ve enabled internal debugging and I’m not getting any errors or exceptions from log4net.

My config file is below.
Thanks

<log4net>
        <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender" >
            <layout type="log4net.Layout.PatternLayout">
                <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
            </layout>
        </appender>
        <appender name="FileAppender" type="log4net.Appender.FileAppender">
            <file value="C:\log-file.txt" />
            <appendToFile value="true" />
            <layout type="log4net.Layout.PatternLayout">
                <conversionPattern value="%date [%thread] %-5level %logger [%ndc] - %message%newline" />
            </layout>
        </appender>
        <root>
            <level value="DEBUG" />
            <appender-ref ref="ConsoleAppender" />
            <appender-ref ref="FileAppender" />
        </root>
    </log4net>

The code to log is effectively:-

public class Logger
{
    private static readonly ILog defaultLog;
    static Logger()
    {
        BasicConfigurator.Configure();
        defaultLog = LogManager.GetLogger("default");
    }

    public static void Log(string errorMessage, Exception exception)
    {
        defaultLog.Error(errorMessage, exception);
    }
}
  • 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-05-26T19:54:30+00:00Added an answer on May 26, 2026 at 7:54 pm

    Based on your description I assumed, that you used the BasicConfigurator (supports only ConsoleAppender) instead of the XmlConfigurator. Switching to the XmlConfigurator should fix your problem.

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

Sidebar

Related Questions

I'm using log4net to log in my app. My FileAppender is working fine, but
I had Log4Net working on my Local machine. It logged to a DB with
Where do I find XML DTDs or Schema references for things like log4net.Appender.FileAppender configuration?
In log4j, when using a FileAppender with BufferedIO=true and BufferSize=xxx properties (i.e. buffering is
I have a small problem using log4j and FileAppender . When I am using
I'm having some trouble getting log4net to work from ASP.NET 3.5. This is the
We are currently using the log4net appender (web.config snippet): <appender name=FileAppender type=log4net.Appender.RollingFileAppender> Looking for
I'm using Log4Net 2.0, I have it working as required but which to add
Is it possible to configure FileAppender in log4net to add new entries at the
I have multiple instances of a thread class running at any given time. I

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.