Details
Description
Hi,
#Try1
I’m using log4net version 2.0.15 in a .net framework 4.5 class library.
There I export a Logger that uses log4net.
using log4net; using log4net.Config; using System.IO;namespace Logger { public class MyLogger { private static readonly ILog log = LogManager.GetLogger(typeof(MyLogger)); public MyLogger() { // Set up log4net var logRepository = LogManager.GetRepository(System.Reflection.Assembly.GetExecutingAssembly()); XmlConfigurator.Configure(logRepository, new FileInfo("log4net.config")); } public void Log(string message) { log.Info(message); } } }
In addition I have a console app that uses the Logger.
using System;namespace Client { class Program { static void Main(string[] args) { var logger = new Logger.MyLogger(); logger.Log("Start"); Console.WriteLine("Press any key to exit."); Console.ReadKey(); } } }
Excepted result:
Create a log file with the Start word written in.
Actual result:
The log file is not created.
#Try 2
Instead of using nuget package, I cloned the log4net source code and added a reference to the log4net project.
This way it worked fine.
I’m not sure what the issue is..
Any help is highly appreciated!
Thx,
Rachel