I am building an application that calls upon a compiled executable. Said executable's source code project file is referenced by the solution file for the parent application. The child executable is a stand alone command line application. The parent is a effectively a GUI wrapper to the console application. When I compile the console application, I have access to all of log4net's functionality that has been built into the application. However, when I compile the parent project that references the console application's source code files, everything runs correctly but no logs are generated. What would cause this error to occur, and how can this occurrence be fixed? log4net's internal debugging mechanism doesn't throw any messages.
For log4net to start logging within the referenced assembly you will have to:
Configure()
function of log4net by either calling log4net.Config.XmlConfigurator.Configure()
when your application starts, or by adding [assembly: log4net.Config.XmlConfigurator(Watch=true)]
to the AssemblyInfo.cs
file of your wrapper application.For more info about setting up your config see: http://logging.apache.org/log4net/release/manual/configuration.html
I know it's too late but anyway just for reference. Set log4net.Internal.Debug = true in your application and you might see the problem on the console. (do this programmatically since your application might not be able to find it's config file, which was what happened in my case)
On the Process p, after you exec the process using p.start() try to write the stdout to console with this; Console.write(p.StandardOutput.ReadToEnd());
You should be able to see the problem. (why log4net isn't getting configured or why it isn't logging) In my case it was looking for the app.config file in the parent process's working directory. (my app and it's config are present elsewhere on the file system)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With