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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:59:56+00:00 2026-05-26T22:59:56+00:00

I would like use from Spring.NET Aspect library Logging aspect together with log4Net. I

  • 0

I would like use from Spring.NET Aspect library Logging aspect together with log4Net.
I found this article how to use log4Net with Common Logging API.

My test application is console and based on .NET 4.0 Client profile.

1st Attempt

So I refer in my project these libraries:

  • Spring.Core version 1.3.2.40943, runtime v4.0.30319
  • Spring.AOP version 1.3.2.40943, runtime v4.0.30319
  • Common.Logging version: 1.2.0.0, runtime v1.0.3705

Assemblies above I have from Program Files\Spring.NET 1.3.2\bin\net\4.0

  • log4net version: 1.2.10.0, runtime v2.0.50727

I couldn’t find assembly Common.Logging.Log4Net.dll in Program Files\Spring.NET 1.3.2\bin
\net\4.0
so I download this assembly from SourceForge:

  • Common.Logging.Log4Net version 2.0.0.0 runtime v2.0.50727

I configured logger in app.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
      <sectionGroup name="spring">
          <section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core"/>
          <section name="objects" type="Spring.Context.Support.DefaultSectionHandler, Spring.Core"/>
      </sectionGroup>
      <sectionGroup name="common">
        <section name="logging" type="Common.Logging.ConfigurationSectionHandler, Common.Logging" />
      </sectionGroup>
      <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/>
  </configSections>

  <common>
    <logging>
      <factoryAdapter type="Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter, Common.Logging.Log4Net">
        <arg key="configType" value="INLINE" />
      </factoryAdapter>
    </logging>
  </common>

  <log4net>
    <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender">
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%date [%thread] %-5level %logger %ndc - %message%newline" />
      </layout>
    </appender>

    <root>
      <level value="DEBUG" />
      <appender-ref ref="ConsoleAppender" />
    </root>

    <logger name="myLogger">
      <level value="DEBUG" />
    </logger>
  </log4net>

  <spring>
    <context>
      <resource uri="config://spring/objects"/>
    </context>
    <objects xmlns="http://www.springframework.net">
    </objects>
  </spring>
</configuration>

and tried this:

ILog log = LogManager.GetLogger("myLogger");
log.Error("hello world");

I got this runtime error:

{“Could not configure Common.Logging from configuration section
‘common/logging’.”}

Inner exception:

{“An error occurred creating the configuration section handler for
common/logging: Unable to create type
‘Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter,
Common.Logging.Log4Net’ (E:\C#
PROJECTS\STUDY\SPRING.NET\SpringNet.Aspects\LoggingWithLog4Net\bin\Debug\LoggingWithLog4Net.vshost.exe.Config
line 18)”}

StackTrace:

at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[]
keys, SectionInput input, Boolean isTrusted, FactoryRecord
factoryRecord, SectionRecord sectionRecord, Object parentResult) at
System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord
factoryRecord, SectionRecord sectionRecord, Object parentResult,
Boolean getLkg, Boolean getRuntimeObject, Object& result, Object&
resultRuntimeObject) at
System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String
configKey, Boolean getLkg, Boolean checkPermission, Boolean
getRuntimeObject, Boolean requestIsHere, Object& result, Object&
resultRuntimeObject) at
System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String
configKey, Boolean getLkg, Boolean checkPermission, Boolean
getRuntimeObject, Boolean requestIsHere, Object& result, Object&
resultRuntimeObject) at
System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String
configKey, Boolean getLkg, Boolean checkPermission, Boolean
getRuntimeObject, Boolean requestIsHere, Object& result, Object&
resultRuntimeObject) at
System.Configuration.BaseConfigurationRecord.GetSection(String
configKey) at
System.Configuration.ClientConfigurationSystem.System.Configuration.Internal.IInternalConfigSystem.GetSection(String
sectionName) at
System.Configuration.ConfigurationManager.GetSection(String
sectionName) at
System.Configuration.ConfigurationSettings.GetConfig(String
sectionName) at
Common.Logging.ConfigurationReader.GetSection(String sectionName)
at Common.Logging.LogManager.BuildLoggerFactoryAdapter()

2nd Attempt

I think problem must be in version of assembly Common.Logging.Log4Net version 2.0.0.0 runtime v2.0.50727. Because I used Common.Logging version: 1.2.0.0, runtime v1.0.3705.

So I changed Common.Logging version from 1.2.0.0 to 2.0.0.0. I used Common.Logging from SourceForge.

And tested again. I got this error:

Unable to create type
‘Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter,
Common.Logging.Log4Net’

Inner exception:

{“Could not load file or assembly ‘Common.Logging.Log4Net’ or one of
its dependencies. The system cannot find the file
specified.”:”Common.Logging.Log4Net”}

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, Boolean
ignoreCase) at
Common.Logging.ConfigurationSectionHandler.ReadConfiguration(XmlNode
section) in
c:\CCNet\netcommon\trunk\modules\Common.Logging\src\Common\Common.Logging\Logging\ConfigurationSectionHandler.cs:line
130

3rd and last attempt

Finally I found assembly Common.Logging.Log4Net version 1.2.0.2 in spring examples so I used it.

  • Common.Logging.Log4Net version 1.2.0.2
  • Common.Logging version 1.2.0.0
  • log4Net 1.2.10.0

Tested and got again error:

{“Could not configure Common.Logging from configuration section
‘common/logging’.”}

Inner exception:

{“An error occurred creating the configuration section handler for
common/logging: Unable to create type
‘Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter,
Common.Logging.Log4Net’ (E:\C#
PROJECTS\STUDY\SPRING.NET\SpringNet.Aspects\LoggingWithLog4Net\bin\Debug\LoggingWithLog4Net.vshost.exe.Config
line 18)”}

StackTrace:

{“Unable to create type
‘Common.Logging.Log4Net.Log4NetLoggerFactoryAdapter,
Common.Logging.Log4Net'”}

I am really confuse what I do bad? Some problem with assemblies version?

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

    For Spring.NET 1.3.2 you should use:

    • Common.Logging 2.0.0
    • Common.Logging.Log4Net 2.0.0
    • log4net 1.2.10

    Make sure the last two log4net dll’s are copied to the output directory. Since your code doesn’t reference it directly, they might not be copied by Visual Studio.

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

Sidebar

Related Questions

I do not like to use the calendar from .NET, so I would like
I would like to use the FFTW C library from Delphi 2009 and according
I use SharpSvn library from CollabNET. I would like to set revision author while
I have a Perl module that I would like to use from Java. Is
I would like to use an SQLite database from Microsoft Access (access from- or
I would like to use Linq to Xml to get a single XElement from
I would like to use integrated authentication to access a SQL database from a
I would like to use something like the following: SELECT city FROM cities WHERE
I would like to pull artifacts from teamcity. I've been trying to use c#
I am using AdoNetAppender (SQL server) in my asp.net application and would like use

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.