Error in Logger.Write(le);

Topics: Logging Application Block
Jul 12, 2012 at 4:26 AM

I am getting this error. I dont know what is going on.

Error:

The type 'Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging' cannot be resolved. Please verify the spelling is correct or that the full type name is provided.

 

Web config:

 

<?xml version="1.0"?>
<configuration>
    <configSections>
        <section name="securityCryptographyConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Security.Cryptography.Configuration.CryptographySettings, Microsoft.Practices.EnterpriseLibrary.Security.Cryptography, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
        <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="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
    </configSections>
    <securityCryptographyConfiguration />
    <loggingConfiguration name="Logging Application Block" tracingEnabled="true"
        defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">
        <listeners>
            <add name="Full Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging"
                listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
                fileName="..\LogFiles\CoreLibTest_rolling.log" footer="" formatter=""
                header="" rollFileExistsBehavior="Increment" rollInterval="Day"
                timeStampPattern="yyyy-MM-dd" traceOutputOptions="None" />
        </listeners>
        <formatters>
            <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging"
                template="{timestamp}{tab}{category}{tab}{message}{tab}{title}{tab}{machine}{tab}{appDomain}{tab}{processId}{tab}{processName}{tab}{win32ThreadId}{tab}{threadName}"
                name="Text Formatter" />
        </formatters>
        <categorySources>
            <add switchValue="All" name="General">
                <listeners>
                    <add name="Full Trace Listener" />
                </listeners>
            </add>
        </categorySources>
        <specialSources>
            <allEvents switchValue="All" name="All Events" />
            <notProcessed switchValue="All" name="Unprocessed Category" />
            <errors switchValue="All" name="Logging Errors &amp; Warnings">
                <listeners>
                    <add name="Full Trace Listener" />
                </listeners>
            </errors>
        </specialSources>
    </loggingConfiguration>
    <dataConfiguration defaultDatabase="Default" />
    <connectionStrings>
        <add name="Default" connectionString="Data Source=(local);database=NTEST;Integrated Security=true"
            providerName="System.Data.SqlClient" />
    </connectionStrings>
    <appSettings>
        <add key="AppTitle" value="NTEST" />
        <add key="AppInstance" value="Test" />
    </appSettings>
    <system.web>
        <compilation debug="true" targetFramework="4.0" />
    </system.web>
</configuration>

 

 

Jul 12, 2012 at 7:47 AM

Can you use the fully qualified assembly name for the trace listener type:

<add name="Full Trace Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"

--
Randy Levy
Enterprise Library support engineer
entlib.support@live.com 

Jul 12, 2012 at 1:31 PM
Edited Jul 12, 2012 at 1:32 PM

When i add that it comes with the blue line and the error list window shows a warning.

Warning 1 The 'type' attribute is invalid - The value 'Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.RollingFlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' is invalid according to its datatype 'TraceListenerData_SchemaType_KeyConstraint' - The Enumeration constraint failed. C:\Users\Nandu\Documents\Nandu\test\Nanduper\test\testapp\Web.config 11 51 EnopiSTL

Jul 12, 2012 at 7:35 PM

I found the problem, The dll's are not getting copied the working folder. I manually copied teh enterprise library dll's everything worked fine. I may have to find a way how to handle after deployment.