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


Reply via email to