The file 'e:\Builds\EntLib\Latest\Source\Blocks\Logging\Src\Logging\Logger.cs' does not exist.

Topics: Building and extending application blocks, Data Access Application Block, Exception Handling Application Block
Aug 9, 2011 at 8:01 AM

Hi all -

I'm looking for any assistance you can provide.  My goal is to first get my latest environment working, then I am looking to dynamically change my logging database referencences at app start.

I just upgraded from EntLib4.1 to EntLib5 and now am experiencing some issues when working with legacy code.  When attempting to execute the following method (SendLog):

 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.EnterpriseLibrary.Logging;
using System.Threading;
 
public static void SendLog(object obj)
        {
            LogEntry log = obj as LogEntry;
            log.TimeStamp = DateTime.Now;
            log.ExtendedProperties.Add("UserName", Environment.UserName);

            Microsoft.Practices.EnterpriseLibrary.Logging.Logger.Write(log);

        }

I have referenced:  Microsoft.Practices.EnterpriseLibrary.Common, .Data, .Logging, .LoggingDatabase, and .ServiceLocation.
I'm working in .NET 4.0 targeted environment using Visual Studio 2010.

 

I am getting the error:

Locating source for 'e:\Builds\EntLib\Latest\Source\Blocks\Logging\Src\Logging\Logger.cs'. Checksum: MD5 {f2 25 48 6 4b fb 8c ec 2e 85 fe 7f e1 6e 1f 7f}
Determining whether the checksum matches for the following locations:
1: C:\Projects\GEDI\Development\MPA2\MPA.Common\Components\Logger.cs Checksum: MD5 {26 22 54 2f 8 a1 4a cd eb bc 98 cd cc 56 e5 31} Checksum doesn't match.
The file 'e:\Builds\EntLib\Latest\Source\Blocks\Logging\Src\Logging\Logger.cs' does not exist.
Looking in script documents for 'e:\Builds\EntLib\Latest\Source\Blocks\Logging\Src\Logging\Logger.cs'...
Looking in the projects for 'e:\Builds\EntLib\Latest\Source\Blocks\Logging\Src\Logging\Logger.cs'.
The file was found in a project: 'c:\projects\gedi\development\mpa2\mpa.common\components\Logger.cs'.
Determining whether the checksum matches for the following locations:
1: c:\projects\gedi\development\mpa2\mpa.common\components\Logger.cs Checksum: MD5 {26 22 54 2f 8 a1 4a cd eb bc 98 cd cc 56 e5 31} Checksum doesn't match.
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\crt\src\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\src\mfc\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\src\atl\'...
Looking in directory 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\atlmfc\include\'...
The debug source files settings for the active solution indicate that the debugger will not ask the user to find the file: e:\Builds\EntLib\Latest\Source\Blocks\Logging\Src\Logging\Logger.cs.
The debugger could not locate the source file 'e:\Builds\EntLib\Latest\Source\Blocks\Logging\Src\Logging\Logger.cs'.

 


My app.config 

<?xml version="1.0"?>
<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" />
   <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" />
   <sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
      <section name="MPA.Client.UI.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    </sectionGroup>
  </configSections>


	<loggingConfiguration name="Logging Application Block" tracingEnabled="true"
	   defaultCategory="General" logWarningsWhenNoCategoriesMatch="true">
		<listeners>
			<add name="Database Listener" type="Microsoft.Practices.EnterpriseLibrary.Logging.Database.FormattedDatabaseTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging.Database"
			  listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Database.Configuration.FormattedDatabaseTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging.Database"
			  databaseInstanceName="mydB" writeLogStoredProcName="WriteLog"
			  addCategoryStoredProcName="AddCategory" formatter="Text Formatter"
			  traceOutputOptions="None" filter="All" />
			<add name="Formatted EventLog TraceListener" type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FormattedEventLogTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging"
			  listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FormattedEventLogTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging"
			  source="Enterprise Library Logging" formatter="Text Formatter"
			  log="Application" machineName="" traceOutputOptions="None" filter="All" />
		</listeners>
  <formatters>
   <add type="Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.TextFormatter, Microsoft.Practices.EnterpriseLibrary.Logging"
    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;)}"
    name="Text Formatter" />
  </formatters>
  <categorySources>
   <add switchValue="All" name="All Events">
    <listeners>
     <add name="Database Listener" />
		
    </listeners>
   </add>
  </categorySources>
  <specialSources>
   <allEvents switchValue="All" name="All Events">
    <listeners>
     <add name="Database Listener" />
    </listeners>
   </allEvents>
   <notProcessed switchValue="All" name="Unprocessed Category" />
   <errors switchValue="All" name="Logging Errors &amp; Warnings">
    <listeners>
     <add name="Database Listener" />
    </listeners>
   </errors>
  </specialSources>
 </loggingConfiguration>
 <dataConfiguration defaultDatabase="mydB" />
 <connectionStrings>
  <add name="mydB" connectionString="Database=mydBInstance;Server=xxxx;User id=xxxx;Password=xxxx;"
   providerName="System.Data.SqlClient" />
  <add name="mydB2" connectionString="Database=mydBInstance2;Server=xxxx;User id=xxxx;Password=xxxx;"
   providerName="System.Data.SqlClient" />
</connectionStrings> <appSettings> <add key="SiteName" value="xxxx" /> <add key="ClientSettingsProvider.ServiceUri" value="" /> </appSettings> <system.serviceModel> <behaviors> <endpointBehaviors> <behavior name="MPAServiceClientBehavior"> <clientCredentials> <windows allowNtlm="true" /> </clientCredentials> <dataContractSerializer maxItemsInObjectGraph="10000000" /> </behavior> </endpointBehaviors> </behaviors> <bindings> <netTcpBinding> <binding name="netTcpBindingConfiguration" sendTimeout="00:02:00" maxBufferSize="2147483647" maxBufferPoolSize="2147483647" maxReceivedMessageSize="2147483647"> <readerQuotas maxStringContentLength="2147483647" maxArrayLength="2147483647" /> </binding> </netTcpBinding> </bindings> ...

 

 With what I provided, I totally hope you can provide me with some guidance. 

 

 thanks in advance,
Brent

 

 

 

 

 
Aug 9, 2011 at 8:15 AM

Hi,

Are you referencing from Entlib Installation Folder? (commonly C:\Program Files\Microsoft Enterprise Library 5.0\Bin). Try to re-reference those dlls from the Entlib Installation Folder and see if this works?

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
Contact Us

 

Aug 9, 2011 at 8:36 AM

Thanks for the prompt reply!  I just removed all references and re-added from C:\Program Files (x86)\Microsoft Enterprise Library 5.0\Bin\ with no luck. 

On execution of the app, I'm still getting the error I normally encounter = {"Activation error occured while trying to get instance of type LogWriter, key \"\""}.  InnerException:  {"Resolution of the dependency failed, type = \"Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter\", name = \"(none)\".\r\nException occurred while: while resolving.\r\nException is: InvalidOperationException - The type LogWriter cannot be constructed. You must configure the container to supply this value.\r\n-----------------------------------------------\r\nAt the time of the exception, the container was:\r\n\r\n  Resolving Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter,(none)\r\n"}.

 

Thanks,
b

Aug 9, 2011 at 10:37 AM

I tried copy pasting your code and it works fine at my side. I just want to know if this config is defined inside your application and not in a class library?

 

Noel Angelo Bolasoc
Global Technologies and Solutions
Avanade, Inc.
Contact Us

Aug 9, 2011 at 2:33 PM

Thanks Noel.  I'm glad to hear that it looked OK to you, too.

It appears some code that I had not remarked out is the behind the error; after I removed it all worked.  I was trying to configure the DAAB in the main entry point in my app ... looks like I did something wrong, so I will be opening another discussion on that one and can say that this discussion is officially closed.

 

You helped me get there a little faster.  :-)

 

Regards,
Brent