Wednesday 19 March 2014

Logging Tools Log4Net vs ELMAH

Both needs configuration files.

Log4Net

  • Simple general purpose logging tool.
  • Easy to integrate.
  • Creates text file.
  • Log levels: DEBUG, INFO, WARN, ERROR, FATAL.

Pros
  1. Highly configurable logging framework.
  2. Best used by calling explicitly through code.
  3. Can implement exception handling with handlers.
  4. Output: file, console, email.
  5. Thread-safe.
  6. Will not throw unexpected exceptions at run-time potentially causing application to crash.
Cons
  1. Not reliable.

ELMAH (Error Logging Modules And Handlers)

  • Logging and notification of unhandled exceptions.
  • Since it handles all unhandled exceptions, log level is always ERROR.
  • Ability to display a  list of errors and the details of a specific error from a web page.
  • View exceptions via different mechanisms (SQL, RSS, Twitter, files, email etc).
  • Customize filtering logic.
  • Custom HandleError with ELMAH Attribute in ASP.NET MVC

Pros
  1. Good for reporting overall errors and unhandled exceptions.
  2. No change in application code for implementing ELMAH.
  3. Few configuration change.
  4. Good solution for YSOD (Yellow Screen Of Death).

Cons
  1. Can go complex.
  2. Only used for exception messages.


Log4Net - ELMAH - Appender
  • Communicate with ELMAH library on behalf of Log4Net.
  • Adds the ability to make Log4Net entries routed to ELMAH
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam aliquam massa quis mauris sollicitudin commodo venenatis ligula commodo.

Related Posts

0 comments:

Post a Comment