Git Product home page Git Product logo

log4net.http-appender's People

Contributors

rynmsh avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

log4net.http-appender's Issues

log4net:ERROR Could not create Appender [HttpAppender] of type [Log4net.HttpAppender.AsyncBatchHttpAppender, Log4net.HttpAppender].

Hi
I have added following changes to my application:
Added references : log4net and Log4Net.HttpAppender from nugget packages

App.Config

  <!--Required: HTTP endpoint -->
  <ServiceUrl value="https://temp" />

  <!--Required: Project/System ID/Name -->
  <ProjectKey value="ConsoleApp5" />

  <!--Optional: Defaults to machine name -->
  <Environment value="dev|stage|prod" />

  <!--Optional: Maximum number of events to submit per processing round. Default's to 40 -->
  <BatchMaxSize value="20" />

  <!--Optional: Maximum number of events to submit per processing round. Default's to 40 -->
  <BatchSleepTime value="200" />

  <!--Optional: Attach request headers and form values to http logging data. Default's to error,fatal,warn -->
  <!--<LogHttpForLevels value="error,fatal,warn,info" />-->

  <layout type="log4net.Layout.PatternLayout">
    <param name="ConversionPattern" value="%date [%identity] %-5level %logger - %message%newline" />
    
  </layout>
</appender>
<root>
  <level value="ALL" />
  <appender-ref ref="LogFileAppender" />
  <appender-ref ref="HttpAppender" />
</root>

Program.cs

class Program
{
private static readonly ILog Log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
static void Main(string[] args)
{
log4net.Config.XmlConfigurator.Configure();
Log.Info("Info Testing");
Log.Error("Error Testing");
Log.Warn("Warning Testing");
Console.Read();
}
}

I am getting the following error:
log4net:ERROR Could not create Appender [HttpAppender] of type [Log4net.HttpAppender.AsyncBatchHttpAppender, Log4net.HttpAppender]. Reported error follows.
System.IO.FileLoadException: Could not load file or assembly 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821'
at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMarkHandle stackMark, IntPtr pPrivHostBinder, Boolean loadTypeFromPartialName, ObjectHandleOnStack type)
at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, Boolean reflectionOnly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, 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 log4net.Util.SystemInfo.GetTypeFromString(Assembly relativeAssembly, String typeName, Boolean throwOnError, Boolean ignoreCase)
at log4net.Util.SystemInfo.GetTypeFromString(String typeName, Boolean throwOnError, Boolean ignoreCase)
at log4net.Repository.Hierarchy.XmlHierarchyConfigurator.ParseAppender(XmlElement appenderElement)

===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\Shweta.Jain\source\repos\ConsoleApp5\ConsoleApp5\bin\Debug\ConsoleApp5.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: Post-policy reference: log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821
LOG: Attempting download of new URL file:///C:/Users/Shweta.Jain/source/repos/ConsoleApp5/ConsoleApp5/bin/Debug/log4net.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.

log4net:ERROR Appender named [HttpAppender] not found.
'ConsoleApp5.exe' (CLR v4.0.30319: ConsoleApp5.exe): Loaded 'C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\PrivateAssemblies\Runtime\Microsoft.VisualStudio.Debugger.Runtime.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
The program '[7676] ConsoleApp5.exe: Program Trace' has exited with code 0 (0x0).
The program '[7676] ConsoleApp5.exe' has exited with code 0 (0x0).

Can you please fix this issue

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.