Click here to Skip to main content
15,867,330 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
I have 2 Console Projects Proj A, Proj B in one Solution and I am using log4net for Proj A and I am calling the Method in Proj A from Proj B

What I have tried:

I have tried changes the configuration in the Assembly file but no use
Posted
Updated 14-Jul-19 9:20am
v2
Comments
Richard MacCutchan 15-Jul-19 3:12am    
Have you used the debugger to see what actually happens when you run your code?

1 solution

Did you add Project A as a reference in Project B? Did you put all of the configuration information required for Log4Net into the App.Config file of Project B?

When you make an .EXE a reference in another project, you're treating the .EXE as a .DLL. It does not run as it's own separate process. Any code in the .DLL will, by default, use the app.config file of the project that it was imported into.
 
Share this answer
 
v2
Comments
DevCodeproject1 15-Jul-19 1:34am    
Yes, I have added the DLL reference of ProjA in Proj B and app.config of Proj A is Configured
Dave Kreskowiak 15-Jul-19 8:50am    
That's the problem. Re-read what I said. The log4net stuff has to be in the app.config of Project B, NOT A.

Any code in any reference you add to a project will use the app.config of your final executable, NOT of the project being referenced.
George Swan 15-Jul-19 9:05am    
Can you please show the code that calls the logger?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900