Invalid TraceListenerData type in configuration 'listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging"'.

Topics: Exception Handling Application Block, Logging Application Block
Jul 9, 2014 at 10:31 AM
Hi,

I am getting the below errir while logging the trace details.

Invalid TraceListenerData type in configuration 'listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging"'.

at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult)
at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject)
at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject)
at System.Configuration.Configuration.GetSection(String sectionName)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource.DoGetSection(String sectionName)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileBasedConfigurationSource.GetSection(String sectionName)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.ConfigSectionLocator.GetRegistrationsInternal(IConfigurationSource configurationSource, Func3 registrationsAccessor)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.ConfigSectionLocator.GetRegistrations(IConfigurationSource configurationSource)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.CompositeTypeRegistrationsProviderLocator.<GetRegistrations>b__0(ITypeRegistrationsProvider l, IConfigurationSource cs)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.CompositeTypeRegistrationsProviderLocator.<>c__DisplayClass5.<GetRegistrationsInternal>b__4(ITypeRegistrationsProvider l)
at System.Linq.Enumerable.<SelectManyIterator>d__14
2.MoveNext()
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.Unity.UnityContainerConfigurator.RegisterAllCore(IConfigurationSource configurationSource, ITypeRegistrationsProvider rootProvider)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.ContainerModel.ChangeTrackingContainerConfigurator.RegisterAll(IConfigurationSource configurationSource, ITypeRegistrationsProvider rootProvider)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.EnterpriseLibraryContainer.ConfigureContainer(ITypeRegistrationsProvider locator, IContainerConfigurator configurator, IConfigurationSource configSource)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.EnterpriseLibraryContainer.ConfigureContainer(IContainerConfigurator configurator, IConfigurationSource configSource)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.EnterpriseLibraryContainer.CreateDefaultContainer(IConfigurationSource configurationSource)
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.EnterpriseLibraryContainer.CreateDefaultContainer()
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.EnterpriseLibraryContainer.SetCurrentContainerIfNotSet()
at Microsoft.Practices.EnterpriseLibrary.Common.Configuration.EnterpriseLibraryContainer.get_Current()
at Microsoft.Practices.EnterpriseLibrary.Logging.Logger.get_Writer()
at Ally.SCSMAS90.UserSecurityMgmt.Framework.Logging.LogManager.WriteTraceMessage(String message, String entryTitle, TraceEventType eventType) in d:\ALLY-TFS\ALLY_SCS_INSURANCE\ChangeRequests\2014 - CR\2014-05-AAI\CUT\Code\Ally.SCSMAS90.UserSecurityMgmt\Ally.SCSMAS90.UserSecurityMgmt.Framework\Logging\LogManager.cs:line 181
at Ally.SCSMAS90.UserSecurityMgmt.Framework.Logging.LogManager.WriteTraceEndMessage(String entryTitle) in d:\ALLY-TFS\ALLY_SCS_INSURANCE\ChangeRequests\2014 - CR\2014-05-AAI\CUT\Code\Ally.SCSMAS90.UserSecurityMgmt\Ally.SCSMAS90.UserSecurityMgmt.Framework\Logging\LogManager.cs:line 132
at Ally.SCSMAS90.UserSecurityMgmt.Framework.Logging.LogManager.Trace(TraceTypeConstant traceConstants) in d:\ALLY-TFS\ALLY_SCS_INSURANCE\ChangeRequests\2014 - CR\2014-05-AAI\CUT\Code\Ally.SCSMAS90.UserSecurityMgmt\Ally.SCSMAS90.UserSecurityMgmt.Framework\Logging\LogManager.cs:line 102
at Ally.SCSMAS90.UserSecurityMgmt.UI.Login.btnLogin_Click(Object sender, EventArgs e) in d:\ALLY-TFS\ALLY_SCS_INSURANCE\ChangeRequests\2014 - CR\2014-05-AAI\CUT\Code\Ally.SCSMAS90.UserSecurityMgmt\Ally.SCSMAS90.UserSecurityMgmt.UI\Screens\Login.cs:line 81
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Ally.SCSMAS90.UserSecurityMgmt.UI.Program.Main() in d:\UserSecurityMgmt.UI\Program.cs:line 19
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

Code in Class Library:

private static void WriteTraceMessage(string message, string entryTitle, TraceEventType eventType)
    {
        var extendedProperties = new Dictionary<string, object>();
        var entry = new LogEntry(message, "Trace", 5, 1, eventType, entryTitle, extendedProperties);            
        Logger.Writer.Write(entry);
    }

Configuration:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
    <section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
    <section name="exceptionHandling" type="Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Configuration.ExceptionHandlingSettings, Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
    <section name="cachingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.CacheManagerSettings, Microsoft.Practices.EnterpriseLibrary.Caching, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
</configSections>


<loggingConfiguration name="Logging Application Block" tracingEnabled="true"  defaultCategory="Important" logWarningsWhenNoCategoriesMatch="true">
    <listeners>
        <add name="Rolling Flat File Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
             listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
             fileName="C:/Logfiles/RollingFlatFile.log" footer="----------------------------------------"    formatter="Text Formatter" header="----------------------------------------"
             rollFileExistsBehavior="Increment" rollInterval="Day" rollSizeKB="1024"
             timeStampPattern="yyyy-MM-dd" maxArchivedFiles="3" traceOutputOptions="None" filter="All" />

    </listeners>

    <formatters>
        <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging"
          template="Timestamp: {timestamp(local)}{tab}Message: {message}{tab}Category: {category}{tab}Priority: {priority}{tab}EventId: {eventid}{tab}ActivityId: {property(ActivityId)}{tab}Severity: {severity}{tab}Title:{title}{tab}"
          name="Brief Format Text" />
        <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging"
          template="Timestamp: {timestamp}{tab}Message: {message}{tab}Category: {category}{tab}Priority: {priority}{tab}EventId: {eventid}{tab}Severity: {severity}{tab}Title: {title}{tab}Activity ID: {property(ActivityId)}{tab}Machine: {localMachine}{tab}App Domain: {localAppDomain}{tab}ProcessId:
Jul 10, 2014 at 2:45 AM
I would guess that the Enterprise Library assemblies (e.g. Microsoft.Practices.EnterpriseLibrary.Logging.dll) are not being copied to the output directory. What Enterprise Library assemblies are deployed to the output directory?

~~
Randy Levy
entlib.support@live.com
Enterprise Library support engineer
Support How-to