|
View:
New views
3 Messages
—
Rating Filter:
Alert me
|
|
|
Logging from two dlls interopHye.
I wanted to trace my functions by logging some informations. So i developped two dlls (.net interop) wich use log4net for logging. when i execute one of the dlls from asp page, logging is working fine. But when i wanted to use both in the same page with "createObject("Dll1.object) and createObject("Dll2.object") i encounter problems. The problem is a little bitte weard, all functions with the same name in these two dlls , the logs is automatically logged in the last dll instantied. Example(c#) Dll1 : public void foo(){ log.Info("Hello it's me"); } Dll2 : public void foo(){ log.info("Hello it's not me!"); } ASP page : <% set ob = server.createObject("Dll1.object"); set ob1 = server.createObject("Dll2.object"); ob.foo() %> So as result i get the log file of dll2 modified with this content : "Hello it's not me!" and the log file of dll1 is not modified. And to finish, logging is working fine for the function wich has different name in these two dlls. I don't know if i explain well, but in all cases i am sorry for my english. Thank you in advance |
|
|
RE: Logging from two dlls interopThis is not a "logging problem", is it?
I mean, the problem is that the wrong function is being invoked, right? That is presumably happening whether you have logging implemented or not, right? So maybe you should post your problem on a forum about .Net programming for ASP pages. Why can't you just rename the functions that have the same name, if that will fix the problem? Rennie > -----Original Message----- > From: Alaks [mailto:leromantique6@...] > Sent: 7. august 2008 13:21 > To: log4net-user@... > Subject: Logging from two dlls interop > > > Hye. > I wanted to trace my functions by logging some informations. > So i developped two dlls (.net interop) wich use log4net for logging. > when i execute one of the dlls from asp page, logging is > working fine. But when i wanted to use both in the same page > with "createObject("Dll1.object) and > createObject("Dll2.object") i encounter problems. > The problem is a little bitte weard, all functions with the > same name in these two dlls , the logs is automatically > logged in the last dll instantied. > Example(c#) > > Dll1 : > > public void foo(){ > log.Info("Hello it's me"); > } > > Dll2 : > > public void foo(){ > log.info("Hello it's not me!"); > } > > ASP page : > > <% > set ob = server.createObject("Dll1.object"); > set ob1 = server.createObject("Dll2.object"); > ob.foo() > %> > So as result i get the log file of dll2 modified with this content : > "Hello it's not me!" > and the log file of dll1 is not modified. > And to finish, logging is working fine for the function wich > has different name in these two dlls. > > I don't know if i explain well, but in all cases i am sorry > for my english. > > Thank you in advance > > -- > View this message in context: > http://www.nabble.com/Logging-from-two-dlls-interop-tp18868255 > p18868255.html > Sent from the Log4net - Users mailing list archive at Nabble.com. > > > |
|
|
RE: Logging from two dlls interopwell it was a logging problem (or a wrong use by me).
I found the origin of this problem. I thought at the beginning as i use two different dlls , the log4net dll will be loaded twice and i was wrong. For all dlls in same process the log4net is loaded once. So the function "foo" log in the wrong file because when i instantiate these two dlls, each of those dlls uses the function Xmlconfigure, and each have a different file configuration so the first configuration is overrided by the second call to xmlconfigure from the second dll. I solve this problem by giving a unique name for each appender(for these two configuration files) and by creating different logger for each class wich has the same name |
| Free embeddable forum powered by Nabble | Forum Help |