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.
| 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. |
|
|
|
ActiveForums 3.7
|