Ramesh,
The overloaded XmlConfigurator.Configure method maybe what you need,
one of the overloads takes a FileInfo.
http://logging.apache.org/log4net/release/sdk/index.html
If your dll is running in the same AppDomain as the exe that is
using it, you may run into problems as the EXE will want log4net
configured its way and you may want it configured another. I *think* in
this situation you will want to create a repository for your dll and
have you configuration apply to that only. There is some info here
http://logging.apache.org/log4net/release/manual/repositories.html
aaron
Ramesh Vijayaraghavan wrote:
Hello,
I want to log messages from a class library(dll).This dll is called by
a third party application on which I have no control. In other words,
I cannot make the third party application read a app.config file.
A dll by its very nature does not allow loading of app.config file. I
am also not able to find an AssemblyInfo.cs file to make changes to
point to the config file.
I can hard code log4net as follows
FileAppender appender = new log4net.Appender.FileAppender(
new log4net.Layout.PatternLayout("%d [%t]%-5p %c;-
%m%n"),logFile);
// using a FileAppender with a PatternLayout
log4net.Config.BasicConfigurator.Configure(appender);
But this means that the log file is hardcoded and cannot be
configured. How can I make the dll read the config file.
Thanks,
scoliodonAThotmailDOTcom