I need log4net to produce a CSV file and have uncovered this article that implements one. My problem is how to integrate that code to my web project. A straight-up copy paste leaves ReSharper insisting that the namespace be changed from 'CsvLogging' to 'MyApp.Web' which makes sense in that now, the web project's assembly now has a class named 'CsvLogging'.
But log4net is not happy and tosses the error pasted below.
My appender's config looks like:
<layout type=" MyApp.Web.CsvLogging.CsvPatternLayout, MyApp.Web.CsvLogging">
...which from my reading of this article on how to reference a custom pattern , should be correct.
log4net:ERROR Failed to find type [ MyApp.Web.CsvLogging.CsvPatternLayout, MyApp.Web.CsvLogging]
System.IO.FileNotFoundException: Could not load file or assembly 'MyApp.Web.CsvLogging' or one of its dependencies. The system cannot find the file specified.
File name: 'MyApp.Web.CsvLogging'
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.CreateObjectFromXml(XmlElement element, Type defaultTargetType, Type typeConstraint)