Configuration section for Logging cannot be found

Topics: Logging Application Block
Oct 10, 2013 at 3:53 AM
<?xml version="1.0"?>
<configuration>
<configSections>
<section name="loggingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings, Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
  <section name="Raytheon.Highways.Ocr.ResultsService.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false"/>
</sectionGroup>
<sectionGroup name="VippIdentity">
  <section name="Vipp" type="System.Configuration.NameValueSectionHandler"/>
</sectionGroup>
</configSections>
<loggingConfiguration name="Logging Application Block" tracingEnabled="true" defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">
<listeners>
  <add name="Event Log Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    source="OCR Results Service" formatter="Text Formatter" log="OcrResServ Log"
    machineName="." traceOutputOptions="LogicalOperationStack, DateTime, Timestamp, ProcessId, ThreadId, Callstack" />
</listeners>
<formatters>
  <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging, Version=6.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
    template="Timestamp: {timestamp}{newline}&#xD;&#xA;Message: {message}{newline}&#xD;&#xA;Category: {category}{newline}&#xD;&#xA;Priority: {priority}{newline}&#xD;&#xA;EventId: {eventid}{newline}&#xD;&#xA;Severity: {severity}{newline}&#xD;&#xA;Title:{title}{newline}&#xD;&#xA;Machine: {localMachine}{newline}&#xD;&#xA;App Domain: {localAppDomain}{newline}&#xD;&#xA;ProcessId: {localProcessId}{newline}&#xD;&#xA;Process Name: {localProcessName}{newline}&#xD;&#xA;Thread Name: {threadName}{newline}&#xD;&#xA;Win32 ThreadId:{win32ThreadId}{newline}&#xD;&#xA;Extended Properties: {dictionary({key} - {value}{newline})}"
    name="Text Formatter" />
</formatters>
<categorySources>
  <add switchValue="All" name="General">
    <listeners>
      <add name="Event Log 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="Event Log Listener" />
    </listeners>
  </errors>
</specialSources>
</loggingConfiguration>
<exceptionHandling />
<connectionStrings>
<add name="Raytheon.Highways.Ocr.ResultsService.Properties.Settings.TPDB"
  connectionString="Data Source=localhost;Initial Catalog=TPDB;Integrated Security=True;Min Pool Size=1;Max Pool Size=50;Connection Reset=True;Load Balance Timeout=0" />
</connectionStrings>
<configProtectedData>
<providers>
  <add useMachineProtection="true" name="DPAPIProtection" type="System.Configuration.DpapiProtectedConfigurationProvider, System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
</providers>
</configProtectedData>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>
<applicationSettings>
<Raytheon.Highways.Ocr.ResultsService.Properties.Settings>
  <setting name="ExceptionHistoryPeriod" serializeAs="String">
    <value>00:05:00</value>
  </setting>
</Raytheon.Highways.Ocr.ResultsService.Properties.Settings>
</applicationSettings>
<VippIdentity>
<Vipp>
  <add key="00078D99" value="10.101.60.13"/>
</Vipp>
</VippIdentity>

</configuration>
Oct 10, 2013 at 7:28 AM
Is this the actual configuration file deployed with the service? The reason why I ask is that the <exceptionHandling /> element without the appropriate configSection will result in a ConfigurationErrorsException with the message "Configuration system failed to initialize".

The message indicates that the loggingConfiguration configSection is not defined in the configuration file. Can you verify that the proper config file is deployed with the service (as <servicename>.exe.config)?

~~
Randy Levy
entlib.support@live.com
Enterprise Library support engineer
Support How-to
Oct 10, 2013 at 6:31 PM

Randy,

You were correct with regards to the configuration file name vs the service name. I had one as OcrResultsService and the other as OcrResultService. However I have a Wix Installer setting the log file and source and now when write events to the log file I get this at the top of each message.

The description for Event ID 1020 from source RayOcrResults cannot be found. Either the component that raises this event is not installed on your local computer or the installation is corrupted. You can install or repair the component on the local computer.

then my message here.

    Regards,

Inactive hide details for "randylevy" ---10/09/2013 11:28:56 PM---From: randylevy Is this the actual configuration file deployed with the service? The reason why I a

Oct 10, 2013 at 7:19 PM
Thank you very much for your help. I finally resolved the issue. I had to make the log file point to C:\Windows\Microsoft.NET\Framework64\v4.0.30319\EventLogMessages.dll for my .NET application service and after that all is good.

Dave