This project is read-only.
1
Vote

Activation error occured while trying to get instance of type LogWriter, key ""

description

Hi,
 
We are using the Enterprise Library 5.0 in my application.
 
  1. I have created one POC for Enterprise Library 5.0. Its working fine(i.e. Rolling, Flat file and Event Log).
  2. The same POC is using in my Service application. We caught the Exception “Activation error occured while trying to get instance of type LogWriter, key ""”
  3. In my Service project we are not using the database logging ...
     
    Please find the screen shot with an attachment.
     
    Please suggest me how to resolve the issue.
     
    Config file is below like :
     
    <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" />
    </configSections>
    <loggingConfiguration name="" tracingEnabled="true" defaultCategory="General">
    <listeners>
    <add name="Event Log Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    source="Enterprise Library Logging" formatter="Text Formatter"
    log="" machineName="." traceOutputOptions="None" />
    <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"
    footer="---------------------------------------------" formatter="Text Formatter"
    header=""######################################""
    rollFileExistsBehavior="Increment" rollInterval="Day" rollSizeKB="124"
    traceOutputOptions="None" />
    <add name="Flat File Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    fileName="C:\VENKATA\UMS\Srini\SampleUMSLogging\Service\error.log" />
    </listeners>
    <formatters>
    <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    template="Title:{title}{newline}&#xA;Timestamp: {timestamp(local)}{newline}&#xA;Message: {message}{newline}&#xA;Category: {category}{newline}&#xA;Priority: {priority}{newline}&#xA;EventId: {eventid}{newline}&#xA;Severity: {severity}{newline}&#xA;Machine: {localMachine}{newline}&#xA;App Domain: {localAppDomain}{newline}&#xA;ProcessId: {localProcessId}{newline}&#xA;Process Name: {localProcessName}{newline}&#xA;Thread Name: {threadName}{newline}&#xA;Win32 ThreadId:{win32ThreadId}{newline}&#xA;Extended Properties: {dictionary({key} - {value}{newline})}"
    name="Text Formatter" />
    </formatters>
    <categorySources>
    <add switchValue="All" name="General">
    <listeners>
      <add name="Rolling Flat File Trace Listener" />
    </listeners>
    </add>
    <add switchValue="All" name="Category">
    <listeners>
      <add name="Flat File Trace Listener" />
    </listeners>
    </add>
    </categorySources>
    <specialSources>
    <allEvents switchValue="All" name="All Events" />
    <notProcessed switchValue="All" name="Unprocessed Category" />
    <errors switchValue="All" name="Logging Errors & Warnings">
    <listeners>
      <add name="Rolling Flat File Trace Listener" />
    </listeners>
    </errors>
    </specialSources>
    </loggingConfiguration>

file attachments

comments

Haishi wrote Nov 10, 2011 at 3:06 PM

Does the problem have anything to do with the project? Anyway, the problem is becuase LogWritter type is correctly resolved. As you are referencing to specific Ent lib version (5.0.414.0), you need to make sure the corresponding assemblies actually exist - maybe you have a different version of the library installed.

Polepalli wrote Nov 11, 2011 at 5:41 AM

Yes, Why beacuse Trace and Log is not stored in the log file. But i am using all assemblies for Ent lib version (5.0.414.0).

Note: Same Componet is working fine with sample POC. But for our service application(WCF RESTFul Service) is not working. its throws the exception "Activation error occured while trying to get instance of type LogWriter, key "" "

Please guide to resolve the issue.

Thanks,
Venkata

Haishi wrote Nov 13, 2011 at 6:55 PM

Make sure in the config file each assembly reference is indeed in one line (there should not be newline characters).

wrote Feb 1, 2013 at 5:21 AM