How to add extra columns to MS Exception/Logging Block

Posted on 2009-04-28
Last Modified: 2013-11-08
I am using the Microsoft Exception Handling and Logger Blocks. Right now, the Exception Block is writing to the database because of this setting in the web.config below.
This will write to the database out of the box. Does anyone know how to add extra columns and make the logger populate those new columns?
<loggingConfiguration name="Logging Application Block" tracingEnabled="true"

  defaultCategory="SomeError" logWarningsWhenNoCategoriesMatch="true">


    <add databaseInstanceName="DevLogging" writeLogStoredProcName="WriteLog"

      addCategoryStoredProcName="AddCategory" formatter="ErrorFormatter"

      listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=, Culture=neutral, PublicKeyToken=null"

      traceOutputOptions="DateTime" type="Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging.Database, Version=, Culture=neutral, PublicKeyToken=null"

      name="Database Trace Listener" />



    <add template="Timestamp: {timestamp}&#xA;&#xD;&#xA;Message: {message}&#xD;&#xA;Category: {category}&#xD;&#xA;Priority: {priority}&#xD;&#xA;EventId: {eventid}&#xD;&#xA;&#xA;Severity: {severity} &#xD;&#xA;&#xA;Title: {title}&#xD;&#xA;Machine: {machine}&#xD;&#xA;&#xA;Application Domain: {appDomain}; &#xA;Process Id: {processId}; &#xA;Process Name: {processName};&#xD;&#xA;Win32 Thread Id: {win32ThreadId}; &#xA;Thread Name: {threadName}&#xA; &#xD;&#xA;&#xD;&#xA;EXTENDED PROPERTIES: &#xD;&#xA;---------------------&#xD;&#xA;{dictionary({key} = {value} | )}&#xD;&#xA;"

      type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=, Culture=neutral, PublicKeyToken=null"

      name="ErrorFormatter" />



    <add switchValue="All" name="SomeError">


        <add name="Database Trace Listener" />





    <allEvents switchValue="All" name="All Events" />

    <notProcessed switchValue="All" name="Unprocessed Category" />

    <errors switchValue="All" name="Logging Errors &amp; Warnings">


        <add name="Database Trace Listener" />








         <add type="System.Exception, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089"

            postHandlingAction="NotifyRethrow" name="Exception">


              <add logCategory="SomeError" eventId="100" severity="Error"

                title="Some Policy" formatterType="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.TextExceptionFormatter, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=, Culture=neutral, PublicKeyToken=null"

                priority="0" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.LoggingExceptionHandler, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging, Version=, Culture=neutral, PublicKeyToken=null"

                name="Logging Handler" />





Open in new window

Question by:bemara57
    1 Comment
    LVL 9

    Accepted Solution

    You should probably create a custom trace listener as described in

    Although you would probably want to inherit a FormattedDatabaseTraceListener

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
    Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    6 Experts available now in Live!

    Get 1:1 Help Now