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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:06:47+00:00 2026-06-12T05:06:47+00:00

Probably a very simple setup, but I’ve tried to setup Log4Net. In my web.config

  • 0

Probably a very simple setup, but I’ve tried to setup Log4Net. In my web.config I have:

<log4net>
    <appender name="File" type="log4net.Appender.RollingFileAppender">
      <file value="Logs\\Log4Net.log" />
      <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>

    <logger name="File">
      <level value="All" />
      <appender-ref ref="LogFileAppender" />
    </logger>
    <root>
      <level value="ALL"/>
      <appender-ref ref="FileAppender"/>
    </root>
  </log4net>

I have added the following to my configsections:

<configSections>
    <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
  </configSections>

The following in global.asax:

 log4net.Config.XmlConfigurator.Configure();

The following is on my default.aspx:

ILog alog = log4net.LogManager.GetLogger(typeof(_Default));
log4net.ILog logger = log4net.LogManager.GetLogger("File");

protected void Page_Load(object sender, EventArgs e)
{
    if (!Page.IsPostBack)
    {
        SetupSeo(); 
    }
    alog.Error("this test");
    logger.Error("Front page loaded for ip " + Request.UserHostAddress);
}

What is wrong?

  • 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-12T05:06:48+00:00Added an answer on June 12, 2026 at 5:06 am

    I guess it is a Permission issue. The relevant directory do not have sufficent permissions so that ASP.NET can write to that.

    To verify that, Enable log4net internal debugging by adding the below item to the <appSettings> section in the webconfig.

    <add key="log4net.Internal.Debug" value="true"/>
    

    Now add the below to the webconfig as well

    <system.diagnostics>
      <trace autoflush="true">
        <listeners>
          <add 
            name="textWriterTraceListener" 
            type="System.Diagnostics.TextWriterTraceListener" 
            initializeData="C:\myLogFolder\log4net.txt" />
        </listeners>
      </trace>
    </system.diagnostics>
    

    Make sure that myLogFolder folder in C drive have permissions so that ASP.NET can write to that. This will write the internal debugging message to this file. Run the app and see what happens.

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

Sidebar

Related Questions

This is probably very simple, but I can't work it out. I have this
This is another probably very simple question, but I haven't been able to find
This is probably very simple but it's really confusing me. When I implement the
So this one is probably very simple, but I'm having a bit of trouble
I'm trying to do something which is probably very simple, I have a directory
This is probably a very simple question so please forgive my ignorance, but can
This is probably a very simple question but I'm a little confused how this
I know this is probably a very simple question but how would I do
This is probably very simple but I couldn't find anything about in the usual
This is probably VERY simple and silly, but I am trying to use jQuery

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.