Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / April 2007

Tip: Looking for answers? Try searching our database.

Enterprise Library 2.0 configuration error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
dick69anderson@yahoo.com - 26 Mar 2007 19:34 GMT
It is my intent to utilize the Enterprise Library Application Blocks.
I am new to dotNet.  I have downloaded the 'Enterprise Library -
January 2006' version.  The solution built successfully and I can
execute the 'Hands on Labs' for logging.  To transition to my code
base, I did the following:
created a C# console application,
added the project references
       (Microsoft.Practices.EnterpriseLibrary.Common.dll
       Microsoft.Practices.EnterpriseLibrary.Logging.dll
       Microsoft.Practices.ObjectBuilder.dll),
created the app.config file with the 'Enterprise Libray Configuration'
utility (contents below),
saved and closed both solution and configuration files.

When I execute the solution within Visual Studio 2005, I receive the
following error:

The configuration section for Logging
cannot be found in the configuration source.

A section with the name of "loggingConfiguration" definitely exists.
It is like it does not see my app.config file.

                -  app.config  contents -
<configuration>
   <configSections>
       <section name="loggingConfiguration"
type="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.LoggingSettings,
Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=null" />
   </configSections>
   <loggingConfiguration name="Logging Application Block"
tracingEnabled="true"
       defaultCategory="General"
logWarningsWhenNoCategoriesMatch="true">
       <listeners>
           <add source="Enterprise Library Logging" formatter="Text
Formatter"
               log="Btest" machineName=""
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData,
Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=null"
               traceOutputOptions="None"
type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener,
Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=null"
               name="Formatted EventLog TraceListener" />
       </listeners>
       <formatters>
           <add template="Timestamp: {timestamp}&#xD;&#xA;Message:
{message}&#xD;&#xA;Category: {category}&#xD;&#xA;Priority:
{priority}&#xD;&#xA;EventId: {eventid}&#xD;&#xA;Severity:
{severity}&#xD;&#xA;Title:{title}&#xD;&#xA;Machine:
{machine}&#xD;&#xA;Application Domain: {appDomain}&#xD;&#xA;Process
Id: {processId}&#xD;&#xA;Process Name: {processName}&#xD;&#xA;Win32
Thread Id: {win32ThreadId}&#xD;&#xA;Thread Name:
{threadName}&#xD;&#xA;Extended Properties: {dictionary({key} -
{value}&#xD;&#xA;)}"

type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter,
Microsoft.Practices.EnterpriseLibrary.Logging, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=null"
               name="Text Formatter" />
       </formatters>
       <categorySources>
           <add switchValue="All" name="General">
               <listeners>
                   <add name="Formatted EventLog TraceListener" />
               </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="Formatted EventLog TraceListener" />
               </listeners>
           </errors>
       </specialSources>
   </loggingConfiguration>
</configuration>

                -  MyLoggingBTest.cs  contents -
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.EnterpriseLibrary.Common.Configuration;
using Microsoft.Practices.EnterpriseLibrary.Logging;

namespace MyLoggingBTest
{
   class Program
   {
       static void Main(string[] args)
       {
           LogEntry log = new LogEntry();
           log.Message = string.Format("Logging has been successfully
added to the application ");
           Logger.Write(log);

       }
   }
}

Would anyone be willing to steer me in the right direction?

Thanks
Phil Bolduc - 04 Apr 2007 08:26 GMT
Was the app.config file added to your project?

Was the app.config file copied to output directory with name
MyLoggingBTest.exe.config ? (assuming your exe was generated with that name)

Was the Enterprise Library 2.0 assemblies copied to the output directory?

> It is my intent to utilize the Enterprise Library Application Blocks.
> I am new to dotNet.  I have downloaded the 'Enterprise Library -
[quoted text clipped - 46 lines]
>         <formatters>
>             <add template="Timestamp: {timestamp}
Message:
> {message}
Category: {category}
Priority:
> {priority}
EventId: {eventid}
Severity:
> {severity}
Title:{title}
Machine:
> {machine}
Application Domain: {appDomain}
Process
> Id: {processId}
Process Name: {processName}
Win32
> Thread Id: {win32ThreadId}
Thread Name:
> {threadName}
Extended Properties: {dictionary({key} -
> {value}
)}"
>  
> type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter,
[quoted text clipped - 48 lines]
>
> Thanks

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.