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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T16:54:35+00:00 2026-05-24T16:54:35+00:00

This is only the 2nd time I’ve tried to use log4net. This is a

  • 0

This is only the 2nd time I’ve tried to use log4net. This is a Windows form app and I thought things are set up OK but I was not getting any logfile created. I found some advice about needing to explicitly make it read the app.config file so I added log4net.Config.XmlConfigurator.Configure() here:

public partial class GridForm : Form
{
    public static readonly ILog log = LogManager.GetLogger(typeof(GridForm));

    public GridForm()
    {
        InitializeComponent();
                                          // Initialize log4net (make him read the app.config file)
        log4net.Config.XmlConfigurator.Configure();     // this gives the exception 
    }

I have a little uncertainty about how I’m referencing the log4net.dll.

  • I have 2 projects in the solution – CBMI.Common which is a class library project and CBMI.WinFormsUI which is my forms project (startup form).
  • I copied log4net.dll to the bin directory of CBMI.Common (NOT the bin\debug folder)
  • then added a reference in my forms project that points to that location: CBMI.Common\bin

This compiles without error. I think that it should be OK, but…

I cannot determine what to do from the exception raised and messages shown:

System.IO.FileNotFoundException crossed a native/managed boundary
  Message=Could not load file or assembly 'Log4net' or one of its dependencies. The system cannot find the file specified.
  Source=mscorlib
  FileName=Log4net
  FusionLog==== Pre-bind state information ===
LOG: User = HPpavilion\john
LOG: DisplayName = Log4net
 (Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: Log4net | Domain ID: 1
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Users/john/documents/visual studio 2010/Projects/CBMI.LatitudePostConverter/CBMI.WinFormsUI/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\john\documents\visual studio 2010\Projects\CBMI.LatitudePostConverter\CBMI.WinFormsUI\bin\Debug\CBMI.WinFormsUI.vshost.exe.Config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Users/john/documents/visual studio 2010/Projects/CBMI.LatitudePostConverter/CBMI.WinFormsUI/bin/Debug/Log4net.DLL.
LOG: Attempting download of new URL file:///C:/Users/john/documents/visual studio 2010/Projects/CBMI.LatitudePostConverter/CBMI.WinFormsUI/bin/Debug/Log4net/Log4net.DLL.
LOG: Attempting download of new URL file:///C:/Users/john/documents/visual studio 2010/Projects/CBMI.LatitudePostConverter/CBMI.WinFormsUI/bin/Debug/Log4net.EXE.
LOG: Attempting download of new URL file:///C:/Users/john/documents/visual studio 2010/Projects/CBMI.LatitudePostConverter/CBMI.WinFormsUI/bin/Debug/Log4net/Log4net.EXE.

  StackTrace:
       at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, Boolean loadTypeFromPartialName, ObjectHandleOnStack type)
       at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, Boolean loadTypeFromPartialName)
       at System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark)
       at System.Type.GetType(String typeName, Boolean throwOnError)
       at System.Configuration.Internal.InternalConfigHost.System.Configuration.Internal.IInternalConfigHost.GetConfigType(String typeName, Boolean throwOnError)
       at System.Configuration.Internal.DelegatingConfigHost.GetConfigType(String typeName, Boolean throwOnError)
       at System.Configuration.TypeUtil.GetTypeWithReflectionPermission(IInternalConfigHost host, String typeString, Boolean throwOnError)
  InnerException: 

For completeness, I will add the app.config file:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
    <sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
        <section name="CBMI.WinFormsUI.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
    </sectionGroup>

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

</configSections>

<userSettings>
  <CBMI.WinFormsUI.Properties.Settings>
        <setting name="DefaultRootFolder" serializeAs="String">
            <value />
        </setting>
    </CBMI.WinFormsUI.Properties.Settings>
</userSettings>

<log4net>
    <appender name="LogFileAppender" type="log4net.Appender.RollingFileAppender">
        <param name="File" value="log-file.txt"/>
        <param name="AppendToFile" value="true"/>
        <rollingStyle value="Size"/>
        <maxSizeRollBackups value="10"/>
        <maximumFileSize value="10MB"/>
        <staticLogFileName value="true"/>
        <layout type="log4net.Layout.PatternLayout">
          <param name="ConversionPattern" value="%-5p%d{yyyy-MM-dd hh:mm:ss} – %m%n"/>
        </layout>
    </appender>
    <root>
        <level value="DEBUG"/>
        <appender-ref ref="LogFileAppender"/>
    </root>
</log4net>

<startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
</startup>

</configuration>
  • 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-24T16:54:36+00:00Added an answer on May 24, 2026 at 4:54 pm

    The fix for me was to insert [assembly: log4net.Config.XmlConfigurator(Watch = true)] into assemblyinfo.cs

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

Sidebar

Related Questions

I am getting this error but only very occasionally. 99.9% of the time it
javaspec.org should contain a java-related wiki; but it seems down... Is this only temporary
This only helps kills processes on the local machine. How do I kill processes
After logging in using the Login control the browser loses the session. This only
I have only this in my mxml source code: <?xml version=1.0 encoding=utf-8?> <mx:Canvas xmlns:mx=http://www.adobe.com/2006/mxml
This is really only easy to explain with an example, so to remove the
I'm only asking this because I'm finding as I get older, it becomes a
As I am currently doing this project in only C, I've up untill this
Can any one explain why the output of this code is only 'hello' and
I've used the CF Remote Performance Monitor , however this seems to only track

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.