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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T19:21:51+00:00 2026-06-02T19:21:51+00:00

I use Log4Net for logging. When the application starts, I call log4net.Config.XmlConfigurator.Configure(); But this

  • 0

I use Log4Net for logging. When the application starts, I call

log4net.Config.XmlConfigurator.Configure();

But this line takes 15 seconds to finish. Am I doing something wrong? Or is it normal?

I am developing with ASP.NET MVC, an use Unity for dependency injection.

At the application start, I call a Bootstrapper Initialise function

protected void Application_Start()
{
    IUnityContainer container = Bootstrapper.Initialise();
    ...
    ...
}

In the Bootstrapper Initialize function, I register the type ILog.

private static IUnityContainer BuildUnityContainer()
{
    var container = new UnityContainer();
    ...
    ...
    container.RegisterType<ILog>("", new ContainerControlledLifetimeManager(),
        new InjectionFactory(factory =>
        LogManager.GetLogger(typeof(HomeController).Assembly, connectionString)));
    ...
    ...
}

At the beginning of GetLogger function I call the configure function

public static ILog GetLogger(Assembly assembly, string connectionString)
{
    log4net.Config.XmlConfigurator.Configure();  //<----- it takes 15 seconds to finish
    ...
    ...
}  

EDIT
———————————————————————————

<log4net>
  <appender name="AdoNetAppender" type="log4net.Appender.AdoNetAppender">
    <bufferSize value="0" />
    <connectionType value="System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
    <connectionString value="data source=[database server];initial catalog=[database name];integrated security=false;persist security info=True;User ID=[user];Password=[password]" />
    <commandText value="INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Message],[Exception],[UserId],[Operation],[EntityType],[EntityId],[IP],[Host],[SessionId],[LogGroup]) VALUES (@log_date, @thread, @log_level, @logger, @message, @exception, @UserId, @Operation, @EntityType, @EntityId, @IP, @Host, @SessionId, @LogGroup)" />
    <parameter>
      <parameterName value="@log_date" />
      <dbType value="DateTime" />
      <layout type="log4net.Layout.RawTimeStampLayout" />
    </parameter>
    <parameter>
      <parameterName value="@thread" />
      <dbType value="String" />
      <size value="255" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%thread" />
      </layout>
    </parameter>
    <parameter>
      <parameterName value="@log_level" />
      <dbType value="String" />
      <size value="50" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%level" />
      </layout>
    </parameter>
    <parameter>
      <parameterName value="@logger" />
      <dbType value="String" />
      <size value="255" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%logger" />
      </layout>
    </parameter>
    <parameter>
      <parameterName value="@message" />
      <dbType value="String" />
      <size value="4000" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%message" />
      </layout>
    </parameter>
    <parameter>
      <parameterName value="@exception" />
      <dbType value="String" />
      <size value="2000" />
      <layout type="log4net.Layout.ExceptionLayout" />
    </parameter>
    <parameter>
      <parameterName value="@UserId"/>
      <dbType value="Int32" />
      <layout type="log4net.Layout.RawPropertyLayout">
        <key value="UserId" />
      </layout>
    </parameter>
    <parameter>
      <parameterName value="@IP"/>
      <dbType value="String" />
      <size value="25" />
      <layout type="log4net.Layout.RawPropertyLayout">
        <key value="IP" />
      </layout>
    </parameter>
    <parameter>
      <parameterName value="@Host"/>
      <dbType value="String" />
      <size value="50" />
      <layout type="log4net.Layout.RawPropertyLayout">
        <key value="Host" />
      </layout>
    </parameter>
    <parameter>
      <parameterName value="@LogGroup"/>
      <dbType value="Int32" />
      <layout type="log4net.Layout.RawPropertyLayout">
        <key value="LogGroup" />
      </layout>
    </parameter>
    <parameter>
      <parameterName value="@Operation"/>
      <dbType value="Int32" />
      <layout type="log4net.Layout.RawPropertyLayout">
        <key value="Operation" />
      </layout>
    </parameter>
    <parameter>
      <parameterName value="@EntityType"/>
      <dbType value="Int32" />
      <layout type="log4net.Layout.RawPropertyLayout">
        <key value="EntityType" />
      </layout>
    </parameter>
    <parameter>
      <parameterName value="@EntityId"/>
      <dbType value="Int32" />
      <layout type="log4net.Layout.RawPropertyLayout">
        <key value="EntityId" />
      </layout>
    </parameter>
    <parameter>
      <parameterName value="@SessionId"/>
      <dbType value="String" />
      <size value="88" />
      <layout type="log4net.Layout.RawPropertyLayout">
        <key value="SessionId" />
      </layout>
    </parameter>
  </appender>
  <root>
    <level value="ALL" />
    <appender-ref ref="AdoNetAppender" />
  </root>
</log4net>
  • 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-02T19:21:52+00:00Added an answer on June 2, 2026 at 7:21 pm

    15 Seconds sounds like a (connection) timeout, I believe the default timeout is 15 seconds.

    I had a similar problem once and it turned out to be The CLR tried to verify the authenticode signature at load time to create publisher evidence for an assembly.
    I am not sure about the details but there is a configuration element named “generatePublisherEvidence” in the assembly section where it can be turned off. You should check if you want to do this though. And what the implications for this are.
    If you are using .Net 4 (or greater) this should have no impact on load time.

    For web applications this setting cannot be set in the applications web.config. It should be set in the aspnet.config in the .Net framework directory.

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

Sidebar

Related Questions

We use log4net for logging application exceptions for a variety of web applications. At
This is a Bad Idea, I know, but... I want to configure log4net programmatically
I am trying to properly use Ninject to inject log4net logging into my MVC3
We have a ASP .Net application whereby we use Log4Net to log details within
We use the log4net to log the winform application's event and error. Our customer
How to use multiple appender in same log4net config file? Also provide how to
use this website a lot but first time posting. My program creates a number
Do I need to use locking model when use log4net from windsor logging facility
We are trying to use Log4Net to log from our IIS 6-deployed WCF Application.
Have Log4Net configured in our application to use a date stamped name and a

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.