Sunday, November 23, 2008
 
The best way to analyze your logs! Minimize
 Log4Net Mail archive   

The Log4Net mailing list is a great source of information about using log4Net, in this forum we collect all the messages in the log4net user list and some selected threads from the developer list.

Subject: Logging from two dlls interop
Prev Next
You are not authorized to post a reply.

Author Messages
Alaks

08/07/2008 1:20 PM  


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-tp18868255p18868255.html
Sent from the Log4net - Users mailing list archive at Nabble.com.

Rennie Petersen

08/08/2008 10:46 AM  

This 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

Alaks

09/27/2008 10:45 PM  


well 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

You are not authorized to post a reply.
Forums > Log4Net > Log4Net Mail archive > Logging from two dlls interop



ActiveForums 3.7

 

 

 

 

 

 

 

 

Log4Net Dashboard

Log analysis and monitoring made easy!

Log4Net Dashboard is a log viewer that can read log statements from a variety of logging output targets.

You can download a free developer version.

  

Check it out!

On the demonstration site you can try it  with live data.demo.l4ndash.com - Try Log4Net Dashboard with live data

The mail archive is a copy of all the mail sent to the mail address: log4net-user@logging.apache.org, organized as a forum.

If you would like to participate in the mail list, send a mail to log4net-user-subscribe@logging.apache.org.

More information about the mailing list is available on: http://logging.apache.org/log4net/support.html

 

A complete topic list is available and can be viewed here (warning, it takes some time to load)

 

Copyright 2005-2008 by FaktNet AS Terms Of Use Privacy Statement