Search code examples
loggingenterprise-librarytracesource

TraceSource vs Enterprise logging block


Are there any specific uses cases where just using TraceSource will not be enough and one should consider looking into other logging libraries ( like Enterprise logging block, log4net, NLog etc)?


Solution

  • A few reasons to use a logging library:

    1. It provides functionality or flexibility that you need and saves development effort

    You may want to use Enterprise Library if you want to log to:

    • Email
    • WMI
    • MSMQ
    • Database

    I believe these are not supported by the .NET TraceListeners.

    In addition if you want some rolling file behavior (e.g. new file every day or after certain size etc.) then that is also supported in Enterprise Library, log4net etc. With Enterprise Library, Message format can also be set at runtime via configuration so that adds some flexibility.

    2. Developers may be more familiar with a common logging library rather than a custom approach

    Most projects that I've been on have used a logging library of some sort.

    3. It can provide a level of abstraction over and above the built in logging functionality