You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@logging.apache.org by "Fred am Nil (Jira)" <ji...@apache.org> on 2024/09/16 11:44:00 UTC
[jira] [Closed] (LOG4NET-693) Using log4net via nuget is not creating a log file in .NET 5
[ https://issues.apache.org/jira/browse/LOG4NET-693?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Fred am Nil closed LOG4NET-693.
-------------------------------
Resolution: Abandoned
Please open an issue at [https://github.com/apache/logging-log4net/issues] in case this is still relevant.
> 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
> Priority: Blocker
> Labels: .NET, Log4Net, c#
>
> 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)