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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T10:18:33+00:00 2026-05-12T10:18:33+00:00

I have my log4net Wrapper and log4net dll in its own class project and

  • 0

I have my log4net Wrapper and log4net dll in its own class project and i have added the following to assemblyinfo.cs of the class project

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

So my main project has the log4net.config file and logging is working in my main project.

I also have another class project (nothing to do with log4net) which my main project (where logging is working) calls the class project. So i enter the new class project and need to log something but IsDebugEnabled returns false .. this is the line

      LogManager.GetLogger("DebugLogger").IsDebugEnabled;

So main project (webproject) which has a reference to my LOGGING class return TRUE, but a class project that i call from my main project returns false.

It appears that the class project isn’t reading the log4net

Any ideas?

  • 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-12T10:18:33+00:00Added an answer on May 12, 2026 at 10:18 am

    If I follow correctly, your setup is like this:

    Web Project (web.config and log4net.config)

    • references Logging Wrapper
    • references Class Library Project

    Logging wrapper

    • References log4net
    • Contains assembly:XmlConfigAttribute

    Class Library Project

    • References log4net

    Although you haven’t posted any details on your log4net “wrapper” class, I’m assuming that your Web Project isn’t accessing log4net directly, but through your wrapper.

    As per my last answer, log4net is resolving the config and constructing the logging repository in your wrapper project. While I’m fairly certain that there’s only one repository per AppDomain, it sounds like your Class Library Project isn’t finding the default repository. Since it’s at the AppDomain level, I doubt that it is exclusive to your wrapper Assembly directly.

    Instead, this sounds like a timing issue. What happens if you call the wrapper first and then your class library? I suspect you’ll find that if you call your Class Library Project first, you won’t get a logger. However, if the very first logging call is to your wrapper, any subsequent requests for a logger should work. This is because the wrapper project contains the config setup information and that first call will configure the logging repository for the AppDomain.

    While I’m not a huge fan of wrapping log4net, you can fix this issue by forcing a call to your wrapper in the application startup logic, or by having your Class Library project use your wrapper. Keep in mind that if you use the wrapper concept, your Class Library won’t be able to leverage all the log4net built in features (like IsDebugEnabled) and you will have to resolve these settings through your wrapper.

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

Sidebar

Related Questions

I have wrapped Log4net in a static wrapper and want to log loggingEvent.LocationInformation.MethodName loggingEvent.LocationInformation.ClassName
I have written a simple log4net wrapper. I was wondering whether this wrapper code
I have two projects configured identically for log4net. One project logs fine; however, the
I have the following stringBuilder that I am using as part of Log4net log
I have class MyLogger, where I use log4net. How can I modify my appender
I have implement a custom log4net appender by extending the AppenderSkeleton-class. It was as
Have Log4Net configured in our application to use a date stamped name and a
In logging frameworks like log4j & log4net you have the ability to log various
I need a logging framework in my application. I have two candidates: Log4Net and
Playing with log4net, I have seen the possibility to use a per-thread stack of

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.