Log4net does not create a log file for the project file with a link

I am creating an application that calls a compiled executable. The specified source code executable source file refers to a solution file for the parent application. The resident executable is a standalone command line application. Parent is an efficient GUI shell for a console application. When I compile a console application, I have access to all the log4net functions that were built into the application. However, when I compile a parent project that references the source code files of the console application, everything runs correctly, but no logs are generated. What can cause this error and how can it be fixed? The log4net internal debugging engine does not send any messages.

+3
source share
2 answers

In order for log4net to start registering in the specified assembly, you need to:

  • Call the Configure()log4net function by calling it log4net.Config.XmlConfigurator.Configure()at application startup or by adding your wrapper application [assembly: log4net.Config.XmlConfigurator(Watch=true)]to the file AssemblyInfo.cs.
  • Create a log4net configuration section in app.config for your GUI shell if you haven’t already. Add the app.config file to your project and copy the log4net configuration information from the link library into it.
  • Make sure that the account running the application has write and log access to the log directory (provided that you are using file-based recording).

. : http://logging.apache.org/log4net/release/manual/configuration.html

+5

, . log4net.Internal.Debug = true , . ( , , )

p p.start() stdout ; Console.Write(p.StandardOutput.ReadToEnd());

. ( log4net ) app.config . ( )

+1

Source: https://habr.com/ru/post/1754268/


All Articles