rachel created LOG4NET-693:
------------------------------

             Summary: Using log4net via nuget is not creating a log file in 
.NET 5 
                 Key: LOG4NET-693
                 URL: https://issues.apache.org/jira/browse/LOG4NET-693
             Project: Log4net
          Issue Type: Bug
         Environment: using visual studio 2022/2019
            Reporter: rachel


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.
{code:java}
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);
        }
    }
}
 {code}
In addition I have a console app that uses the Logger.
{code:java}
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();
        }
    }
}
 {code}
*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



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to