Cant get the log file using Rolling flat file

Topics: Logging Application Block
Jan 20, 2012 at 10:28 AM
Edited Jan 20, 2012 at 10:30 AM

hello

i cant see the log file in the given path nor in the windows event viewer.i am givng here the AppBlocks.config.Please help me out.

<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" />
  </configSections>
  <loggingConfiguration name="" tracingEnabled="true" defaultCategory="General">
    <listeners>
      <add name="Error 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://temp/error.log" footer="" formatter="Text Formatter"
        header="" rollInterval="Minute" rollSizeKB="1" maxArchivedFiles="1"
        traceOutputOptions="None" filter="All" />
      <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"
        listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.RollingFlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        fileName="C://temp/full.log" footer="" formatter="Text Formatter"
        header="" rollFileExistsBehavior="Increment" rollInterval="Minute"
        rollSizeKB="5" traceOutputOptions="none" />
    </listeners>
    <formatters>
      <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        template="Timestamp: {timestamp(local)}{newline}Message: {message}{newline}Category: {category}{newline}Priority: {priority}{newline}EventId: {eventid}{newline}ActivityId: {property(ActivityId)}{newline}Severity: {severity}{newline}&#xA;"
        name="Text Formatter" />
    </formatters>
    <logFilters>
      <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Filters.LogEnabledFilter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        enabled="true" name="Logging Enabled Filter" />
    </logFilters>
    <categorySources>
      <add switchValue="All" name="Category">
        <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="Error Trace Listener" />
        </listeners>
      </errors>
    </specialSources>
  </loggingConfiguration>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0,Profile=Client"/>
  </startup>
</configuration>

Jan 20, 2012 at 9:59 PM

Your config file is slightly malformed.  

 traceOutputOptions="none" should actually be  traceOutputOptions="None"

Also, you mention that you are posting "AppBlocks.config".  Usually you have your configuration in app.config or web.config unless you are using some other advanced configuration options.  

Can you confirm where the configuration is located and also double check if it is being loaded.  You could use ConfigurationManager.GetSection("loggingConfiguration") to manually load the configuration and verify that it is present.


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