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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:36:44+00:00 2026-06-14T20:36:44+00:00

I have log4net working with an external config file, by telling my app config

  • 0

I have log4net working with an external config file, by telling my app config where to find the config file and then calling XmlConfigurator.Configure() when the app starts.

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

This works, but I now want to watch for changes,According to the documentation I should be able to use the assembly attribute to achieve this, which also means I don’t need to call XmlConfigurator.Configure() any more. So, I add this to the AssemblyInfo.cs for the main app (and also for the project it references):

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

Trouble is, this does nothing at all. If I remove the call to XmlConfigurator.Configure(), then the logging doesn’t work – no logging is initiated. Those attributes don’t seem to make a difference. So, I can’t get watching the file working at all.

Can anyone advise?

  • 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-14T20:36:46+00:00Added an answer on June 14, 2026 at 8:36 pm

    Sussed it.

    It was because the first logging message came from another assembly. As the log4net docs say:

    it is imperative to make a logging call as early as possible during the application start-up, and certainly before any external assemblies have been loaded and invoked.

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

Sidebar

Related Questions

I have the following in my web.config: <log4net> <appender name=mainLog type=log4net.Appender.FileAppender> <file value=Log/Log.txt />
Given that you have [assembly: log4net.Config.XmlConfigurator(ConfigFile = Log4Net.config, Watch = true)] in your AssemblyInfo.cs
Hey I have this configuration in my web.config <log4net> <appender name=LogFileAppender type=log4net.Appender.FileAppender> <param name=File
I'm working on configuring a RollingFileAppender in log4net programmatically. I have something like this
I have a console project that I have been working on. I added log4net
I have some troubles while writing logs from log4net to the file. I seem
We are using log4net and want to specify it's configuration in an external config
I have been working on getting log4net working in a demo program for a
I have here this log4net config: <log4net> <root> <level value=DEBUG /> <appender-ref ref=LogFileAppender />
I am using log4net for logging, I have two appenders one file and other

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.