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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T21:45:55+00:00 2026-05-18T21:45:55+00:00

I am trying to use log4net with ASP.NET MVC and I cannot get anything

  • 0

I am trying to use log4net with ASP.NET MVC and I cannot get anything to happen with it.
I’ve created a config that is in my web project root:

<log4net>
    <root>
        <level value="INFO" />
        <appender-ref ref="RollingLogFileAppender"/>
    </root>
    
    <appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
        <file value="C:\DWSApplicationFiles\AppLogs\app.log" />
        <appendToFile value="true" />
        <rollingStyle value="Size" />
        <maxSizeRollBackups value="10" />
        <maximumFileSize value="100KB" />
        <staticLogFileName value="true" />
        <layout type="log4net.Layout.PatternLayout">
            <conversionPattern value="%d [%t]%-5p %c [%x] - %m%n" />
        </layout>
    </appender>
    
    <appender name="RollingLogFileAppender" type="log4net.Appender.RollingFileAppender">
        <file value="C:\DWSApplicationFiles\AppLogs\app.log" />
        <appendToFile value="false" />
        <datePattern value="-dddd" />
        <rollingStyle value="Date" />
        <layout type="log4net.Layout.PatternLayout">
            <conversionPattern value="%d [%t]%-5p %c [%x] - %m%n" />
        </layout>
    </appender>
</log4net>

Before I am asked: yes, the application has permission to write to the directory. I have tested this and the application has permission to this directory.

Here is where I am trying to use log4net:

public class HomeController : Controller
{
    readonly log4net.ILog log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
    public ActionResult Index()
    {
        log.Error("In Index  ");
         return View();
    }
}

When I run the application and go to this controller log4net does nothing; it doesn’t create the files in that directory or anything.

I have enabled internal debugging for log4net and I get no output errors in the console.
The following is all I see from log4net:

log4net: log4net assembly [log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821]. Loaded from [C:\Users\twaldron.BULLFROGSPAS\AppData\Local\Temp\Temporary ASP.NET Files\root\7642c99a\60feb7f2\assembly\dl3\17247033\008dfd6d_e2d0ca01\log4net.DLL]. (.NET Runtime [2.0.50727.4952] on Microsoft Windows NT 6.1.7600.0)

log4net: DefaultRepositorySelector: defaultRepositoryType [log4net.Repository.Hierarchy.Hierarchy]

log4net: DefaultRepositorySelector: Creating repository for assembly [Bullfrog.DWS.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]

log4net: DefaultRepositorySelector: Assembly [Bullfrog.DWS.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null] Loaded From [C:\Users\twaldron.BULLFROGSPAS\AppData\Local\Temp\Temporary ASP.NET Files\root\7642c99a\60feb7f2\assembly\dl3\2960c79f\b876bb2d_aca7cb01\Bullfrog.DWS.Web.DLL]

log4net: DefaultRepositorySelector: Assembly [Bullfrog.DWS.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null] does not have a RepositoryAttribute specified.

log4net: DefaultRepositorySelector: Assembly [Bullfrog.DWS.Web, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null] using repository [log4net-default-repository] and repository type [log4net.Repository.Hierarchy.Hierarchy]

log4net: DefaultRepositorySelector: Creating repository [log4net-default-repository] using type [log4net.Repository.Hierarchy.Hierarchy]
‘WebDev.WebServer20.EXE’ (Managed (v2.0.50727)): Loaded ‘Anonymously Hosted DynamicMethods Assembly’

  • 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-18T21:45:55+00:00Added an answer on May 18, 2026 at 9:45 pm

    Do you have something like this in global.asax?

    void Application_Start(object sender, EventArgs e)
    {
        string l4net = Server.MapPath("~/log4net.config");
        log4net.Config.XmlConfigurator.ConfigureAndWatch(new System.IO.FileInfo(l4net));
    
        ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to use log4net in an ASP.NET application with Visual Studio 2005.
I am trying to use NServiceBus with an ASP.NET MVC 2 website (using VS
I am trying to use log4net in a VB.NET app for some unknown reason
Im trying to use my web Config files in Silverlight. I've put the following
I trying to use ImageInfo and Jython to get information from a image on
I'm having some trouble getting log4net to work from ASP.NET 3.5. This is the
We are trying to use Log4Net to log from our IIS 6-deployed WCF Application.
I'm trying to use log4net to write to a customer event log under IIS7
here is an easy question coming: i am trying to use log4net to log
I'm trying to customise a log4net file path to use a property I have

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.