Reputation: 1
I have .net core 3.1 console application which is referring to a .net class library project.
I am getting the below exception.
log4net:ERROR Could not create Appender [aiAppender] of type [Microsoft.ApplicationInsights.Log4NetAppender.ApplicationInsightsAppender, Microsoft.ApplicationInsights.Log4NetAppender]. Reported error follows. System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.ApplicationInsights.Log4NetAppender, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified. File name: 'Microsoft.ApplicationInsights.Log4NetAppender, Culture=neutral, PublicKeyToken=null' at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, StackCrawlMarkHandle stackMark, ObjectHandleOnStack assemblyLoadContext, Boolean loadTypeFromPartialName, ObjectHandleOnStack type, ObjectHandleOnStack keepalive) at System.RuntimeTypeHandle.GetTypeByName(String name, Boolean throwOnError, Boolean ignoreCase, StackCrawlMark& stackMark, AssemblyLoadContext assemblyLoadContext, Boolean loadTypeFromPartialName) at System.RuntimeType.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase, 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)
log4net:ERROR Appender named [aiAppender] not found.
App.config:
<log4net>
<root>
<level value="ALL" />
<appender-ref ref="aiAppender" />
</root>
<appender name="aiAppender" type="Microsoft.ApplicationInsights.Log4NetAppender.ApplicationInsightsAppender, Microsoft.ApplicationInsights.Log4NetAppender">
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%message%newline" />
</layout>
</appender>
</log4net>
to solve this issue I tried to add a package from NuGet package manager Microsoft.ApplicationInsights.Log4NetAppender
, but I am getting the below error while adding this package.
Failed to fetch results from V2 feed at 'http://fxnugetserver.azurewebsites.net/nuget/FindPackagesById()?id='runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl'&semVerLevel=2.0.0' with following message : The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters. The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
But my project path is just J:\fx-core
Please help me to solve this issue
Upvotes: 1
Views: 1918
Reputation: 11
Try reinstalling log4net nuget package, if that doesn't help check in folder directory-bin-Debug if you are missing log4net and log4net.dll files.
Upvotes: 1
Reputation: 1
I just added log4net
package to both the projects and error is gone now.
Upvotes: 2