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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T22:44:57+00:00 2026-05-11T22:44:57+00:00

I have been attempting to get log4net logging in my asp.net web application with

  • 0

I have been attempting to get log4net logging in my asp.net web application with no success or any noticable errors. I am attempting to use the ADONetAppender appender with the following config:

<log4net>
<appender name="ADONetAppender" type="log4net.Appender.ADONetAppender">
  <bufferSize value="1" />
  <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
  <connectionString value="server=" />
  <commandText value="INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Message],[Exception],[Context]) VALUES 
                            (@log_date, @thread, @log_level, @logger, @message, @exception, @context)" />
  <parameter>
    <parameterName value="@log_date" />
    <dbType value="DateTime" />
    <layout type="log4net.Layout.RawTimeStampLayout" />
  </parameter>
  <parameter>
    <parameterName value="@thread" />
    <dbType value="String" />
    <size value="32" />
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%t" />
    </layout>
  </parameter>
  <parameter>
    <parameterName value="@log_level" />
    <dbType value="String" />
    <size value="512" />
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%p" />
    </layout>
  </parameter>
  <parameter>
    <parameterName value="@context" />
    <dbType value="String" />
    <size value="512" />
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%x" />
    </layout>
  </parameter>
  <parameter>
    <parameterName value="@logger" />
    <dbType value="String" />
    <size value="512" />
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%c" />
    </layout>
  </parameter>
  <parameter>
    <parameterName value="@message" />
    <dbType value="String" />
    <size value="4000" />
    <layout type="log4net.Layout.PatternLayout">
      <conversionPattern value="%m" />
    </layout>
  </parameter>
  <parameter>
    <parameterName value="@exception" />
    <dbType value="String" />
    <size value="2000" />
    <layout type="log4net.Layout.ExceptionLayout" />
  </parameter>
</appender>
<root>
  <level value="DEBUG" />
  <appender-ref ref="ADONetAppender" />
</root>

In my global.asax Application_Start I call

log4net.Config.XmlConfigurator.Configure();

Then to attempt to log:

protected static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
protected void Page_Load(object sender, EventArgs e)
{            
    log.Info("did I log yet?");
}

All of this does nothing as far as I can tell.

  • 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-11T22:44:57+00:00Added an answer on May 11, 2026 at 10:44 pm

    Have you added added the following section under under Configuration->Configsections

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

    Although it is possible to add your log4net configuration settings to your project’s app.config or web.config file, it is preferable to place them in a separate configuration file. Aside from the obvious benefit of maintainability, it has the added benefit that log4net can place a FileSystemWatcher object on your config file to monitor when it changes and update its settings dynamically.

    To use a separate config file, add a file named Log4Net.config to your project and add the following attribute to your AssemblyInfo.cs file:

    [assembly: log4net.Config.XmlConfigurator(ConfigFile = "Log4Net.config", Watch = true)]
    

    Note: for web applications, this assumes Log4Net.config resides in the web root. Ensure the log4net.config file is marked as “Copy To Output” -> “Copy Always” in Properties.

    From here.

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

Sidebar

Related Questions

I have been working with Visual Studio (WinForm and ASP.NET applications using mostly C#)
I have been looking into IKVMing Apache's FOP project to use with our .NET
I have been attempting to have a object that I can use across multiple
I have been attempting to enhance my GUI system written in Java to use
I have been attempting to compile/run a sample WCF application from Juval Lowy's website
I have been attempting this all morning (VS2K10, OL2K7, .NET 3.5) and my PSTs
I have been attempting to write some routines to read RSS and ATOM feeds
I have been experimenting with woopra.com A web analytics tool. Which requires a piece
I have been working on a web services related project for about the last
For the past few days I have been attempting to write my own shell

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.