Friday, September 10, 2010
 
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: Log in more than 1 log desination for different assemblies.
Prev Next
You are not authorized to post a reply.

Author Messages
cristianmad

08/04/2009 2:38 PM  

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

cristianmad

08/04/2009 2:39 PM  

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

Florin Daneliuc

08/04/2009 3:12 PM  

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

cristianmad

08/04/2009 3:23 PM  

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

08/04/2009 3:29 PM  

Yes, in the application configuration file.

You are not authorized to post a reply.
Forums > Log4Net > Log4Net Mail archive > Log in more than 1 log desination for different assemblies.



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