Microsoft
Software
Hardware
Network
Question : Common.Logging and Log4Net.xml file not found issue
Dear All,
I am using Common.Logging to do the logging function. I have a windows application, which runs ok to log. The code is as simple as:
NameValueCollection properties = new NameValueCollection();
properties["configType"] = "FILE-WATCH";
properties["configFile"] = "./Log4Net.xml";
LogManager.Adapter = new Log4NetLoggerFactoryAdapte
r(properti
es);
ILog log = LogManager.GetCurrentClass
Logger();
log.Debug(strMessage);
--------------------
I think as long as that "Log4Net.xml" is under bin or bin/debug folder, it is fine.
However I also created another windows service project which will call the methods in my previous application. But this time when it goes to:
LogManager.Adapter = new Log4NetLoggerFactoryAdapte
r(properti
es);
It says "file Log4Net.xml os not found". Actually I have put that configuration file under the bin/debug folder of both 2 projects, but it still reports error.
Does anyone know actually which directory it is looking at when my windows service calling that method?
Thanks heaps!
Answer : Common.Logging and Log4Net.xml file not found issue
I guess that you need to get working directory of windows services, using statement
dir = Path.GetDirectoryName(Asse
mbly.GetEx
ecutingAss
embly().Lo
cation);
properties["configFile"] = dir+"/Log4Net.xml";
Random Solutions
Default buton of login control in usercontrol
You don't have the license required to use this ActiveX control.
Update and Join gives syntax error (missing operator)
What is the VBA to do this in Access?
Access 97 - Convert Numbers from Decimal to Time
decrease update interval/speed of shared mailbox exchange 2003 and entourage
Need to update first booking of the day for each person within a time period
Access 2000 Relink front-end to back-end tables using a path supplied by an .ini file
Populate Text box based on combo box
Access 2003 Macro Question: How to set focus to a specific tab on a tab control within an existing macro?