Well, I'm new to .net and I've been searching some loging tools available for c#. I found, TraceListener and Log4Net created by Apache Foundation, have very wide use even in large projects. But what are the main differences between this two? What are the advantages of Log4Net? In what situation I should use Log4Net and where TraceListener?
Including, What are the disadvantages of Log4Net and TraceListener? What are their break points?
log4net is a tool to help the programmer output log statements to a variety of output targets. In case of problems with an application, it is helpful to enable logging so that the problem can be located. With log4net it is possible to enable logging at runtime without modifying the application binary.
Log4net provides a simple mechanism for logging information to a variety of sources. Information is logged via one or more loggers. These loggers provide 5 levels of logging: Debug.
Is log4net thread-safe? Yes, log4net is thread-safe.
The TraceListener is part of the default logging implementation in .NET. While this works just fine to see what your application is doing (very helpful during development), log4net offers much greater flexibility with regards to the logging output. log4net allows you to configure where your logging output should go (for example: to a file, to the event log, etc.) and allows you to finetune what you want to see logged.
For instance, you want much more diagnostic information on development and test environments while you're only interested in warnings and fatal errors on the acceptance and production environments. With log4net, you can simply configure what you want to be logged, and this can be changed at any time after an application has been deployed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With