Wednesday, May 8, 2013

Enterprise logging application block

Event logging is required from web applications and servers for diagnostics. Applications choose from a variety of application such as ELMAH, Enterprise application block etc. ELMAH is based on http proxy and is great for listening in on http requessts and responses however enterprise application block provides a much more robust and rich framework for logging. Application can write events to the following:
event log
e-mail message
database
message queue
text file
wmi event
and custom locations
The application provides a consistent interface for logging information to destination. Application configuration settings determine what the destination is so one location can be swapped with another without any modification of the application code.
The same application block can be used within the application and across the enterprise. LogEntry is written with context information and is helpful for tracing. Priority, Severity and Categories when specified in the LogEntry can be very helpful to differentiate events and analyze them. Events when they are sent to the event viewer can be analyzed with tools such as LogParser
Logging Application Block can be extended in the following manner.
Create a new custom class and add it to the project
The class should implement the required interfaces
Create the custom object in the Enterprise Library Configuration Console
Specify the custom class as the type name
specify any custom configuration properties by modifying the attributes of the object

No comments:

Post a Comment