Extending the FormattedTraceListenerBase

Topics: Building and extending application blocks, Logging Application Block
May 5, 2008 at 6:15 PM
I have followed the format from the Ent Lib FormattedTraceListener class to create a customized database trace listener for my customized LogEntry class.

I have compiled and tried to add to an existing project (via Resources) and referencing through a custom trace listener in the Ent Lib Manager. I have created both the class and the configuration.Data class. I feel I am missing something as this should work. So far all examples have been in C# (not VB.net).

I have removed comments to make it readable.

John

/begin code/
Imports System
Imports System.Data
Imports System.Data.Common
Imports System.Collections.Specialized
Imports System.Diagnostics
Imports System.IO
Imports System.Collections.Generic
Imports Microsoft.Practices.EnterpriseLibrary.Common.Configuration
Imports Microsoft.Practices.EnterpriseLibrary.Data
Imports Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration
Imports Microsoft.Practices.EnterpriseLibrary.Logging.Formatters
Imports Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners
Imports System.Globalization
Imports TempTesting.Configuration

<ConfigurationElementType(GetType(TempTraceListenerData))> _
Public Class TempTraceListener
Inherits FormattedTraceListenerBase
Private _strWriteLogStoredProcName As String = String.Empty
Private _strAddCategoryStoredProcName As String = String.Empty
Private _dbDatabase As Microsoft.Practices.EnterpriseLibrary.Data.Database

Private _strUserName As String
Private _strIPAddress As String
Private _strFunctionName As String
Private _strFormName As String
Private _strPageName As String
Private _strCulture As String
Private _intLineNumber As Integer

#Region "Constructors"
Public Sub New(ByVal dbDatabase As Microsoft.Practices.EnterpriseLibrary.Data.Database, ByVal strWriteLogStoredProcName As String, ByVal strAddCategoryStoredProcName As String, ByVal oFormatter As ILogFormatter)
MyBase.New(oFormatter)
_strWriteLogStoredProcName = strWriteLogStoredProcName
_strAddCategoryStoredProcName = strAddCategoryStoredProcName
_dbDatabase = dbDatabase

_strUserName = String.Empty
_strIPAddress = String.Empty
_strFunctionName = String.Empty
_strFormName = String.Empty
_strPageName = String.Empty
_strCulture = String.Empty
_intLineNumber = 0
End Sub

#End Region

#Region "Write Methods"
Public Overrides Sub Write(ByVal oEntry As Object)
Dim oLogEntry As Microsoft.Practices.EnterpriseLibrary.Logging.LogEntry

If TypeOf oEntry Is Microsoft.Practices.EnterpriseLibrary.Logging.LogEntry Then
oLogEntry = DirectCast(oEntry, Microsoft.Practices.EnterpriseLibrary.Logging.LogEntry)
If (ValidateParameters(oLogEntry)) Then ExecuteStoredProcedure(oLogEntry)
InstrumentationProvider.FireTraceListenerEntryWrittenEvent()
ElseIf TypeOf oEntry Is String Then
Write(DirectCast(oEntry, String))
Else
MyBase.Write(oEntry)
End If
'MyBase.Write(o)
End Sub

Public Overloads Sub Write(ByVal strProcessID As String, ByVal intSeverity As TraceEventType, _
ByVal strUserName As String, ByVal strIPAddress As String, ByVal strFunctionName As String, _
ByVal strFormName As String, ByVal strPageName As String, _
ByVal strCulture As String, ByVal strMessage As String)
ExecuteWriteLogStoredProcedure(strProcessID, DateTime.Now, intSeverity, strUserName, _
strIPAddress, strFunctionName, strFormName, strPageName, strCulture, _
strMessage, GetLineInfo(strMessage), _dbDatabase)
End Sub

Public Overloads Overrides Sub Write(ByVal strMessage As String) ...
Public Overloads Overrides Sub WriteLine(ByVal strMessage As String)...

#End Region

Public Overrides Sub TraceData(ByVal eventCache As System.Diagnostics.TraceEventCache, ByVal source As String, ByVal eventType As System.Diagnostics.TraceEventType, ByVal id As Integer, ByVal data As Object)
Dim oLogEntry As Microsoft.Practices.EnterpriseLibrary.Logging.LogEntry

If TypeOf data Is Microsoft.Practices.EnterpriseLibrary.Logging.LogEntry Then
oLogEntry = DirectCast(data, Microsoft.Practices.EnterpriseLibrary.Logging.LogEntry)
If (ValidateParameters(oLogEntry)) Then ExecuteStoredProcedure(oLogEntry)
InstrumentationProvider.FireTraceListenerEntryWrittenEvent()
ElseIf TypeOf data Is String Then
Write(DirectCast(data, String))
Else
MyBase.TraceData(eventCache, source, eventType, id, data)
End If
End Sub

Protected Overrides Function GetSupportedAttributes() As String()
Return New String() formatter", "writeLogStoredProcName", "addCategoryStoredProcName", "databaseInstanceName
'Return MyBase.GetSupportedAttributes()
End Function

Private Function ValidateParameters(ByVal oLogEntry As Microsoft.Practices.EnterpriseLibrary.Logging.LogEntry) As Boolean
Dim bValid As Boolean = True

If _strWriteLogStoredProcName Is Nothing Or _strWriteLogStoredProcName.Length = 0 Then Return False
If _strAddCategoryStoredProcName Is Nothing Or _strAddCategoryStoredProcName.Length = 0 Then Return False

Return bValid
End Function

Private Sub ExecuteStoredProcedure(ByVal oLogEntry As Microsoft.Practices.EnterpriseLibrary.Logging.LogEntry)
Dim intLogID As Integer
Using connection As DbConnection = _dbDatabase.CreateConnection()
connection.Open()
Try
Using transaction As DbTransaction = connection.BeginTransaction()
Try
Integer.TryParse(CStr(ExecuteWriteLogStoredProcedure(oLogEntry, _dbDatabase, transaction)), intLogID)
ExecuteAddCategoryStoredProcedure(oLogEntry, intLogID, _dbDatabase, transaction)
transaction.Commit()
Catch
transaction.Rollback()
Throw
End Try
End Using
Finally
connection.Close()
End Try
End Using
End Sub


Private Function ExecuteWriteLogStoredProcedure(ByVal logEntry As Microsoft.Practices.EnterpriseLibrary.Logging.LogEntry, _
ByVal db As Microsoft.Practices.EnterpriseLibrary.Data.Database, _
ByVal transaction As DbTransaction) As Integer
Dim cmd As DbCommand
Dim inLogID As Integer
Dim strUserName As String = String.Empty
Dim strIPAddress As String = String.Empty
Dim strFunctionName As String = String.Empty
Dim strFormName As String = String.Empty
Dim strPageName As String = String.Empty
Dim strCulture As String = String.Empty
Dim intLineNumber As Integer = 0

If logEntry.ExtendedProperties IsNot Nothing And logEntry.ExtendedProperties.Count > 0 Then
With logEntry.ExtendedProperties
If .ContainsKey("UserName") Then strUserName = .Item("UserName").ToString()
If .ContainsKey("IPAddress") Then strIPAddress = .Item("IPAddress").ToString()
If .ContainsKey("FunctionName") Then strFunctionName = .Item("FunctionName").ToString()
If .ContainsKey("FormName") Then strFormName = .Item("FormName").ToString()
If .ContainsKey("PageName") Then strPageName = .Item("PageName").ToString()
If .ContainsKey("Culture") Then strCulture = .Item("Culture").ToString()

End With
End If

cmd = db.GetStoredProcCommand(_strWriteLogStoredProcName)
/* add parameters */

db.ExecuteNonQuery(cmd, transaction)

inLogID = Convert.ToInt32(cmd.Parameters(cmd.Parameters.Count - 1).Value, CultureInfo.InvariantCulture)
Return inLogID
End Function

...
May 5, 2008 at 6:18 PM
TempTraceListenerData.vb (continued from prev post)
/begin code/
Imports System
Imports System.Diagnostics
Imports System.ComponentModel
Imports System.Configuration
Imports Microsoft.Practices.ObjectBuilder
Imports Microsoft.Practices.EnterpriseLibrary.Common.Configuration
Imports Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ObjectBuilder
Imports Data = Microsoft.Practices.EnterpriseLibrary.Data
Imports Microsoft.Practices.EnterpriseLibrary.Logging.Formatters
Imports Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners
Imports Microsoft.Practices.EnterpriseLibrary.Logging.Configuration
Imports TempTesting

Namespace Configuration
''' <summary>
''' Represents the configuration data for a <see cref="TempTraceListener"/>.
''' </summary>
<Assembler(GetType(TempTraceListenerAssembler))> _
Public Class TempTraceListenerData
Inherits TraceListenerData

Private Const writeLogStoredProcNameProperty As String = "writeLogStoredProcName"
Private Const addCategoryStoredProcNameProperty As String = "addCategoryStoredProcName"
Private Const databaseInstanceNameProperty As String = "databaseInstanceName"
Private Const formatterNameProperty As String = "formatter"

''' <summary>
''' Initializes a new instance of the <see cref="TempTraceListenerData"/> class.
''' </summary>
Public Sub New()

End Sub

''' <summary>
''' Initializes a named instance of <see cref="FormattedDatabaseTraceListenerData"/> with
''' name, stored procedure name, databse instance name, and formatter name.
''' </summary>
''' <param name="name">The name.</param>
''' <param name="writeLogStoredProcName">The stored procedure name for writing the log.</param>
''' <param name="addCategoryStoredProcName">The stored procedure name for adding a category for this log.</param>
''' <param name="databaseInstanceName">The database instance name.</param>
''' <param name="formatterName">The formatter name.</param>
Public Sub New(ByVal name As String, ByVal writeLogStoredProcName As String, _
ByVal addCategoryStoredProcName As String, _
ByVal databaseInstanceName As String, _
ByVal formatterName As String)
Me.New(name, writeLogStoredProcName, addCategoryStoredProcName, databaseInstanceName, formatterName, TraceOptions.None)

End Sub

''' <summary>
''' Initializes a new instance of the <see cref="TempTraceListenerData"/> class.
''' </summary>
''' <param name="name">The name for the configuration object.</param>
''' <param name="writeLogStoredProcName">The stored procedure name for writing the log.</param>
''' <param name="addCategoryStoredProcName">The stored procedure name for adding a category for this log.</param>
''' <param name="databaseInstanceName">The database instance name.</param>
''' <param name="formatterName">The formatter name.</param>
''' <param name="traceOutputOptions">The trace options.</param>
Public Sub New(ByVal name As String, ByVal writeLogStoredProcName As String, _
ByVal addCategoryStoredProcName As String, _
ByVal databaseInstanceName As String, _
ByVal formatterName As String, ByVal traceOutputOptions As TraceOptions)
MyBase.New(name, GetType(TempTraceListener), traceOutputOptions)
Me.DatabaseInstanceName = databaseInstanceName
Me.WriteLogStoredProcName = writeLogStoredProcName
Me.AddCategoryStoredProcName = addCategoryStoredProcName
Me.Formatter = formatterName
End Sub

''' <summary>
''' Gets and sets the database instance name.
''' </summary>
<ConfigurationProperty(databaseInstanceNameProperty, IsRequired:=False)> _
Public Property DatabaseInstanceName() As String
Get
Return MyBase.Item(writeLogStoredProcNameProperty).ToString()
End Get
Set(ByVal value As String)
MyBase.Item(writeLogStoredProcNameProperty) = value
End Set
End Property



''' <summary>
''' Gets and sets the stored procedure name for writing the log.
''' </summary>
<ConfigurationProperty(writeLogStoredProcNameProperty, IsRequired:=True)> _
Public Property WriteLogStoredProcName() As String
Get
Return MyBase.Item(writeLogStoredProcNameProperty).ToString()
End Get
Set(ByVal value As String)
MyBase.Item(writeLogStoredProcNameProperty) = value
End Set
End Property

''' <summary>
''' Gets and sets the stored procedure name for adding a category for this log.
''' </summary>
<ConfigurationProperty(addCategoryStoredProcNameProperty, IsRequired:=True)> _
Public Property AddCategoryStoredProcName() As String

Get
Return MyBase.Item(addCategoryStoredProcNameProperty).ToString()
End Get
Set(ByVal value As String)
MyBase.Item(addCategoryStoredProcNameProperty) = value
End Set
End Property

''' <summary>
''' Gets and sets the formatter name.
''' </summary>
<ConfigurationProperty(formatterNameProperty, IsRequired:=False)> _
Public Property Formatter() As String

Get
Return MyBase.Item(formatterNameProperty).ToString
End Get
Set(ByVal value As String)
MyBase.Item(formatterNameProperty) = value
End Set
End Property
End Class

''' <summary>
''' This type supports the Enterprise Library infrastructure and is not intended to be used directly from your code.
''' Represents the process to build a <see cref="TempTraceListener"/> described by a <see cref="TempTraceListenerData"/> configuration object.
''' </summary>
''' <remarks>This type is linked to the <see cref="TempTraceListenerData"/> type and it is used by the Custom Factory
''' to build the specific <see cref="TraceListener"/> object represented by the configuration object.
''' </remarks>
Public Class TempTraceListenerAssembler
Inherits TraceListenerAsssembler

''' <summary>
''' This method supports the Enterprise Library infrastructure and is not intended to be used directly from your code.
''' Builds a <see cref="TempTraceListener"/> based on an instance of <see cref="TempTraceListenerData"/>.
''' </summary>
''' <seealso cref="TraceListenerCustomFactory"/>
''' <param name="context">The <see cref="IBuilderContext"/> that represents the current building process.</param>
''' <param name="objectConfiguration">The configuration object that describes the object to build. Must be an instance of <see cref="FormattedDatabaseTraceListenerData"/>.</param>
''' <param name="configurationSource">The source for configuration objects.</param>
''' <param name="reflectionCache">The cache to use retrieving reflection information.</param>
''' <returns>A fully initialized instance of <see cref="TempTraceListener"/>.</returns>
Public Overrides Function Assemble(ByVal context As IBuilderContext, ByVal objectConfiguration As TraceListenerData, ByVal configurationSource As IConfigurationSource, ByVal reflectionCache As ConfigurationReflectionCache) As TraceListener

Dim castedObjectConfiguration As TempTraceListenerData
Dim database As Data.Database
Dim formatter As ILogFormatter
Dim createdObject As TraceListener

castedObjectConfiguration = CType(objectConfiguration, TempTraceListenerData)

database = CType(context.HeadOfChain.BuildUp(context, GetType(Data.Database), Nothing, castedObjectConfiguration.DatabaseInstanceName), Data.Database)
formatter = LogFormatterCustomFactory.Instance.Create(context, castedObjectConfiguration.Formatter, configurationSource, reflectionCache)

createdObject = New TempTraceListener( _
database, _
castedObjectConfiguration.WriteLogStoredProcName, _
castedObjectConfiguration.AddCategoryStoredProcName, _
formatter)

Return createdObject
End Function
End Class
End Namespace

/End code/

I cannot access this though the Ent.Lib manager for app.config.
Library 3.1 May 2007, VS 2005.
May 7, 2008 at 2:57 PM
You have only implemented the runtime components for your trace listener. I you want your trace listener to show up in EntLib Configuration Console, then you need implement the design time behavior for your tracelisnter ( you need Design manager, with node, setting builder etc..).
Try using Application block factory.
May 7, 2008 at 4:11 PM


NeoAdroit wrote:
You have only implemented the runtime components for your trace listener. I you want your trace listener to show up in EntLib Configuration Console, then you need implement the design time behavior for your tracelisnter ( you need Design manager, with node, setting builder etc..).
Try using Application block factory.



I have tried the Application Block Factory. I have created the Design manager and nodes. I watched the videos (5 times) and used the Enterprise Library’s {quote}FormattedDatabaseListener{quote} as an example (including the designer and manager). Compiled. I added the DLL’s to the enterprise library bin directory and still it does not show in the console.

There is only the example of how to do this in the library and some of that is convoluted.

I am so frustrated with the lack of good documentation for this. Even the videos are specifically different. The documentation with the Application Block Factory points to the 3.0 Apr release. I am running the 3.1 May version. All the help links do not work for the factory and half of the factory did not compile into the install. I had to manully move over critical pieces to even get it to work.

I have the designers zipped up. (Code is too large for this post).

Thanks for your help.
May 7, 2008 at 8:52 PM
When you drop the design dll of your trace listener in to the bin folder of COnfiguration Console, where you able to see your Trace Listener in the available Tracelisteners under your logging application block ?
If not, few simple things can cause this go wrong
1. You missed add Configuration Design Manager attribute in your assembly configuration, and also make sure you have the right type name (your design manager) specified in it. You probably should already have got this part right already.
2. Signing! make sure you have not delay signed your assembly, if it is delay signed, then make sure the verification is turned off.
3. You might have chosen the wrong type in application block factory, when you selected the type, under which your tracelistener is going to be added. Your Command Register class for the TraceListner should AddUICommand to TraceListenerCollectionNode.

If you have your Design Manager type published using assembly attribute, and your assembly is signed right, and your command register, register a UI command to Trace Listener Collection Node, then you should see your custom trace listener in entlib configuration console.



May 9, 2008 at 7:30 PM
I have five files in my "TempTesting.Configuration.Design" <each will be added separately>

First
<begin code>
Public NotInheritable Class AddTempDatabaseCommand : Inherits AddChildNodeCommand
Public Sub New(ByVal serviceProvider As IServiceProvider)
MyBase.New(serviceProvider, GetType(TempTraceListenerNode))
End Sub

Protected Overrides Sub OnExecuted(ByVal e As System.EventArgs)
MyBase.OnExecuted(e)
Dim node As TempTraceListenerNode = CType(ChildNode, TempTraceListenerNode)
If node Is Nothing Then
Return
End If

If CurrentHierarchy.FindNodeByType(GetType(LoggingSettingsNode)) Is Nothing Then
CType(New AddLoggingSettingsNodeCommand(ServiceProvider), AddLoggingSettingsNodeCommand).Execute(CurrentHierarchy.RootNode)
End If

If CurrentHierarchy.FindNodeByType(GetType(DatabaseSectionNode)) Is Nothing Then
CType(New AddDatabaseSectionNodeCommand(ServiceProvider), AddDatabaseSectionNodeCommand).Execute(CurrentHierarchy.RootNode)
End If

End Sub

End Class
<end code>

Second:
<begin code>
Partial NotInheritable Class CommandRegistrar
Inherits Microsoft.Practices.EnterpriseLibrary.Configuration.Design.CommandRegistrar

Public Sub New(ByVal serviceProvider As IServiceProvider)
MyBase.New(serviceProvider)
End Sub

Public Overrides Sub Register()
AddTempTraceListenerNodeCommand()
AddDefaultCommands(GetType(TempTraceListenerNode))
End Sub
End Class
<end code>

Third
<begin code>
Public NotInheritable Class ConfigurationDesignManager
Inherits Microsoft.Practices.EnterpriseLibrary.Configuration.Design.ConfigurationDesignManager

Public Sub New()

End Sub

Public Overrides Sub Register(ByVal serviceProvider As IServiceProvider)
Dim cmdRegistrar As CommandRegistrar = New CommandRegistrar(serviceProvider)
cmdRegistrar.Register()
Dim nodeRegistrar As NodeMapRegistrar = New NodeMapRegistrar(serviceProvider)
nodeRegistrar.Register()
End Sub

Protected Overrides Sub OpenCore(ByVal serviceProvider As IServiceProvider, ByVal rootNode As ConfigurationApplicationNode, ByVal section As System.Configuration.ConfigurationSection)
MyBase.OpenCore(serviceProvider, rootNode, section)
Dim hierarchy As IConfigurationUIHierarchy = ServiceHelper.GetCurrentHierarchy(serviceProvider)
For Each node As TempTraceListenerNode In hierarchy.FindNodesByType(GetType(TempTraceListenerNode))
For Each connectionStringNode As ConnectionStringSettingsNode In hierarchy.FindNodesByType(GetType(ConnectionStringSettingsNode))
If connectionStringNode.Name = (CType(node.TraceListenerData, TempTraceListenerData)).DatabaseInstanceName Then
node.DatabaseInstanceName = connectionStringNode
Exit For
End If
Next
Next
End Sub
End Class

<end code>

Fourth
<begin code>
NotInheritable Class NodeMapRegistrar
Inherits Microsoft.Practices.EnterpriseLibrary.Configuration.Design.NodeMapRegistrar

Public Sub New(ByVal serviceProvider As IServiceProvider)
MyBase.New(serviceProvider)
End Sub

Public Overrides Sub Register()
AddMultipleNodeMap(My.Resources.TempTraceListenerNodeUICommandText, _
GetType(TempTraceListenerNode), _
GetType(TempTesting.Configuration.TempTraceListenerData))
End Sub
End Class
<end code>
May 9, 2008 at 7:32 PM

Finally:

<begin code>
Public Class TempTraceListenerNode
Inherits Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.Design.TraceListeners.TraceListenerNode

Private Const writeLogStoredProcedureDefault As String = "WriteLog"
Private Const addCategoryStoredProcedureDefault As String = "AddCategory"

Private _databaseName As String
Private _addCategoryStoredProcedure As String
Private _writeLogStoredProcedureName As String
Private _formatterNode As FormatterNode
Private _formatterName As String

Private _connectionStringNode As ConnectionStringSettingsNode
Private _onConnectionStringNodeRemoved As EventHandler(Of ConfigurationNodeChangedEventArgs)
Private _onConnectionStringNodeRenamed As EventHandler(Of ConfigurationNodeChangedEventArgs)
Private _onFormatterNodeRemoved As EventHandler(Of ConfigurationNodeChangedEventArgs)
Private _onFormatterNodeRenamed As EventHandler(Of ConfigurationNodeChangedEventArgs)

Public Sub New()
Me.New(New TempTesting.Configuration.TempTraceListenerData(Resources.TempTraceListenerNodeName, writeLogStoredProcedureDefault, addCategoryStoredProcedureDefault, String.Empty, String.Empty))
End Sub

Public Sub New(ByVal traceListenerData As TempTesting.Configuration.TempTraceListenerData)
MyBase.New()
If traceListenerData Is Nothing Then
Throw New ArgumentNullException("traceListenerData")
End If

Rename(traceListenerData.Name)
TraceOutputOptions = traceListenerData.TraceOutputOptions
_databaseName = traceListenerData.DatabaseInstanceName
_addCategoryStoredProcedure = traceListenerData.AddCategoryStoredProcName
_writeLogStoredProcedureName = traceListenerData.WriteLogStoredProcName
_formatterName = traceListenerData.Formatter
_onConnectionStringNodeRemoved = New EventHandler(Of ConfigurationNodeChangedEventArgs)(AddressOf OnConnectionStringNodeRemoved)
_onConnectionStringNodeRenamed = New EventHandler(Of ConfigurationNodeChangedEventArgs)(AddressOf OnConnectionStringNodeRenamed)
_onFormatterNodeRemoved = New EventHandler(Of ConfigurationNodeChangedEventArgs)(AddressOf OnFormatterNodeRemoved)
_onFormatterNodeRenamed = New EventHandler(Of ConfigurationNodeChangedEventArgs)(AddressOf OnFormatterNodeRenamed)

End Sub

Protected Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
End If
MyBase.Dispose(disposing)
End Sub


<Required()> _
<Editor(GetType(ReferenceEditor), GetType(UITypeEditor))> _
<ReferenceType(GetType(ConnectionStringSettingsNode))> _
<SRCategory("CategoryGeneral", GetType(Resources))> _
<SRDescription("DatabaseInstanceNameDescription", GetType(Resources))> _
Public Property DatabaseInstanceName() As ConnectionStringSettingsNode
Get
Return _connectionStringNode
End Get
Set(ByVal value As ConnectionStringSettingsNode)
connectionStringNode = CType(LinkNodeHelper.CreateReference(connectionStringNode, _
value, _
_onConnectionStringNodeRemoved, _
_onConnectionStringNodeRenamed), ConnectionStringSettingsNode)
If _connectionStringNode Is Nothing Then
_databaseName = String.Empty
Else
_databaseName = _connectionStringNode.Name
End If
End Set
End Property

<Editor(GetType(ReferenceEditor), GetType(UITypeEditor))> _
<ReferenceType(GetType(FormatterNode))> _
<SRDescription("FormatDescription", GetType(Resources))> _
<SRCategory("CategoryGeneral", GetType(Resources))> _
Public Property Formatter() As FormatterNode
Get
Return _formatterNode
End Get
Set(ByVal value As FormatterNode)
formatterNode = CType(LinkNodeHelper.CreateReference(formatterNode, _
value, _
_onFormatterNodeRemoved, _
_onFormatterNodeRenamed), FormatterNode)
If _formatterNode Is Nothing Then
_formatterName = String.Empty
Else
_formatterName = _formatterNode.Name
End If
End Set
End Property

<Required()> _
<SRDescription("WriteStoredProcNameDescription", GetType(Resources))> _
<SRCategory("CategoryGeneral", GetType(Resources))> _
Public Property WriteLogStoredProcedurename() As String
Get
Return _writeLogStoredProcedureName
End Get
Set(ByVal value As String)
_writeLogStoredProcedureName = value

End Set
End Property



<Required()> _
<SRDescription("AddCategoryStoredProcNameDescription", GetType(Resources))> _
<SRCategory("CategoryGeneral", GetType(Resources))> _
Public Property AddCategoryStoredProcName() As System.String
Get
Return _addCategoryStoredProcedure
End Get
Set(ByVal value As System.String)
_addCategoryStoredProcedure = value
End Set
End Property


Public Overrides ReadOnly Property TraceListenerData() As Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.TraceListenerData
Get
Return New TempTraceListenerData(Name, _writeLogStoredProcedureName, _addCategoryStoredProcedure, _databaseName, _formatterName)
End Get
End Property

Protected Overrides Sub SetFormatterReference(ByVal formatterNodeReference As Microsoft.Practices.EnterpriseLibrary.Configuration.Design.ConfigurationNode)
If (_formatterName = formatterNodeReference.Name) Then Formatter = CType(formatterNodeReference, FormatterNode)
End Sub

Private Sub OnFormatterNodeRemoved(ByVal sender As Object, ByVal e As ConfigurationNodeChangedEventArgs)
_formatterName = Nothing
End Sub

Private Sub OnFormatterNodeRenamed(ByVal sender As Object, ByVal e As ConfigurationNodeChangedEventArgs)
_formatterName = e.Node.Name
End Sub

Private Sub OnConnectionStringNodeRemoved(ByVal sender As Object, ByVal e As ConfigurationNodeChangedEventArgs)
_connectionStringNode = Nothing
End Sub

Private Sub OnConnectionStringNodeRenamed(ByVal sender As Object, ByVal e As ConfigurationNodeChangedEventArgs)
_databaseName = e.Node.Name
End Sub

End Class

<end code>
May 30, 2008 at 2:13 PM
Dear All,

I never recieved any help with this.  I was fed up and finally went with a different solution.  According to the documentation, this should not be this hard.  I am sure that something simple is causing it not to work.

I am still looking for any help on this.  Specifically a good example would be appreciated.   As I have stated before, I used the exiting Ent. Lib piece as examples.  It still is not working.

Please help.

John.