Logging Application Block Custom Log Entry

Topics: Configuration, Database, Enterprise Library
Nov 23, 2009 at 6:15 PM
Edited Nov 23, 2009 at 9:09 PM


I am setting up the Logging Application Block. i want to log into the database. In Design of Application Block 

The LogEntry class encapsulates content and associated properties for the information an application sends to the application block for logging. Your client code creates new log entries and sets properties such as the message, title, priority, severity, and event ID. Other properties, such as the process name, process ID, andThreadId, are populated by the application block. A LogEntry object also contains the ExtendedProperties property. This property is a collection of name/value pairs that allows you to place arbitrary string information into the LogEntry object. You can also create a custom LogEntry object by creating a class that derives from the LogEntry class

You must either create new formatters and trace listeners or modify the existing ones to support your custom LogEntry class.

LogEntry object has a collection of categories. The application block determines the destination for the log entry by its categories. You can also prevent the application from writing log entries with a designated category by using category filters. 

I came across Tom Blog. For creating DB Trace Listener and connecting it to a stored Procedure, how can I implement sending custom Log Entries. Using Extended Properties or Custom Classes. Which one is easier to implement and maintain?

To simplify: How to add custom fields to Logging to the DB?