log4net

  • Thread starter Thread starter Jim
  • Start date Start date
J

Jim

Does anyone use log4net in their Add-in application.
I am interested in ohwo you configured it?
Thanks
 
Hello Jim,
Does anyone use log4net in their Add-in application.
I am interested in ohwo you configured it?
Thanks

I successfully use log4net in my addin. In the implementation of the IDTExtensibility2.OnConnection()
method I put the following code

....
// get the directory of the running assembly
FileInfo fi = new FileInfo(Assembly.GetExecutingAssembly().Location);

// try to locate the log4net config file
FileInfo[] files = fi.Directory.GetFiles("log4net.conf");

// if found - configure the log4net
if(files.Length != 0)
XmlConfigurator.Configure(files[0]);
....

"log4net.conf" is a regular log4net configuration that should be placed in
the same directory the assembly is located in.
I tuned it for writing log records into a file, and it works excellent.


Best regards,
Sergey
 
thank you Sergey.
I appreciatet it

Sergey said:
Hello Jim,
Does anyone use log4net in their Add-in application.
I am interested in ohwo you configured it?
Thanks


I successfully use log4net in my addin. In the implementation of the
IDTExtensibility2.OnConnection() method I put the following code
...
// get the directory of the running assembly
FileInfo fi = new
FileInfo(Assembly.GetExecutingAssembly().Location);

// try to locate the log4net config file
FileInfo[] files = fi.Directory.GetFiles("log4net.conf");

// if found - configure the log4net
if(files.Length != 0)
XmlConfigurator.Configure(files[0]);
...

"log4net.conf" is a regular log4net configuration that should be placed
in the same directory the assembly is located in.
I tuned it for writing log records into a file, and it works excellent.


Best regards,
Sergey
 
Back
Top