logging-log4net-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Florin Daneliuc <florin.danel...@iquestint.com>
Subject RE: Log in more than 1 log destination for different assemblies.
Date Tue, 04 Aug 2009 13:12:31 GMT

Yes it is very possible as long as this is properly configured.
>From each of the A and B assemblies you will need to use a different logger and this has
to be properly configured.

In assembly A you will use
log4net.ILog logger = log4net.LogManager.GetLogger("<log name for assembly A>");

and in config file you will have as 
<logger name="<log name for assembly A>">
	<appender-ref ref="AppenderForA" />
where "Appender for A" will configured as described in http://logging.apache.org/log4net/release/config-examples.html
The same for assembly B, just use "B" instead of "A".

For more details I suggest you look into the documentation from  http://logging.apache.org/log4net,
though it might not be very straightforward.

Best regards,

-----Original Message-----
From: cristianmad [mailto:cristianmad2000@yahoo.com] 
Sent: Tuesday, August 04, 2009 3:40 PM
To: log4net-user@logging.apache.org
Subject: Log in more than 1 log destination for different assemblies.


I am new to log4net and just starting reading some documentation about it.
We need to see if it would be a suitable logging solution for our applications. 
Our product (like most of them) uses a number of assemblies. I was wondering if it would be
possible for each assembly to log in its own log file (or any other destination) even if they
are loaded in the same application domain. 
For example consider we have the following assemblies: A.dll and B.dll. Is it possible for
the two assemblies to log in their own log files even if they are loaded in the same application
If yes, could you please give me a very simple example?

Thank you,
View this message in context: http://www.nabble.com/Log-in-more-than-1-log-destination-for-different-assemblies.-tp24807634p24807634.html
Sent from the Log4net - Users mailing list archive at Nabble.com.

View raw message