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:29:19 GMT
Yes, in the application configuration file. 

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


Thank you Florin for the fast response, 

Just to confirm: The configration will be done in the application configuration file, right?
Not, for example, in the A.dll.config and B.dll.config.


Florin Daneliuc-2 wrote:
> 
> 
> 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" />
> </logger>
> 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,
> florin
> 
> -----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.
> 
> 
> Hi,
> 
> 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 domain?
> If yes, could you please give me a very simple example?
> 
> 
> Thank you,
> Cristian
> --
> 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 this message in context: http://www.nabble.com/Log-in-more-than-1-log-destination-for-different-assemblies.-tp24807634p24808629.html
Sent from the Log4net - Users mailing list archive at Nabble.com.


Mime
View raw message