EntLib Config Tool - Admin rights required for Custom Trace Listener

Topics: Logging Application Block
Dec 17, 2012 at 1:04 PM

I was experimenting with creating a Custom Trace Listener and I finally got the Design Time features to work so that I can edit the properties of my custom listener in the EntLib Configuration Tool. I was doing this experimentation at home on my personal computer where I have admin rights on the machine.

I was thinking about implementing a similar Custom Trace Listener in my Enterprise Environment but we do not have local admin rights in our environment. I was wondering if there is any other way to get the design time features to work without having to put my .dll in the "C:\Program Files (x86)\Microsoft Enterprise Library 5.0\Bin" directory.

Dec 17, 2012 at 4:38 PM

For application development my preferred method is to use the EnterpriseLibrary.Config extension.  This integrates into Visual Studio and lets you specify an arbitrary Enterprise Library binaries path (on a solution level) which let's you set multiple search paths to look for Enterprise Library assemblies E.g. if you are using Nuget you might see something like this: 

packages\Unity.2.1.505.2\lib\NET35;packages\Unity.Interception.2.1.505.2\lib\NET35;packages\EnterpriseLibrary.Common.5.0.505.0\lib\NET35;packages\EnterpriseLibrary.Logging.5.0.505.1\lib\NET35)

This let's you append any path you want to pick up custom assemblies or even custom Enterprise Library builds.

Another alternative would be to install/deploy Enterprise Library into a non-admin location.

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

Dec 17, 2012 at 7:29 PM
Edited Dec 17, 2012 at 7:49 PM

Maybe I am missing something but I believe EnterpriseLibrary.Config is exactly what I am using (see screenshots below).

1) The "Logging" project holds my custom trace listener and associated configuration class so that I have design-time support using the EnterpriseLibrary.Config tool. The "SysloggerTest" project is a Console Program that I have configured to use my custom trace listener for logging. (This was configured using EntLibConfig.exe on a machine outside of my corporate environment in which I was able to write to the "C:\Program Files (x86)\Microsoft Enterprise Library 5.0\Bin" directoy).

http://i45.tinypic.com/5yzwyd.jpg

2) This is the error I get when I try to open the app.config under the "SysloggerTest" project with EntLibConfig.exe.

http://i49.tinypic.com/2j1qvx4.jpg

To summarize: I am able to use my custom trace listener within my application no problem and the logging works. My issue is that the EnterpriseLibrary.Config tool itself wont have design time support unless I can copy my custom .dll into the \Bin directory of the EntLibConfig.exe install.

Edit 1: I was mistaken - I am not able to run the program either

Edit 2: Cool - It looks like the EnterpriseLibrary.Configuration extension is what I need

Dec 17, 2012 at 8:22 PM

Ok - I guess I was wrong. I set the "Enterprise Library binaries paths" to:

GlobalSection(ExtensibilityGlobals) = postSolution
     EnterpriseLibraryConfigurationToolBinariesPath = C:\Users\xxxxxxx\Desktop\SysloggerTest\Logging\bin
EndGlobalSection

and it still doesnt work. Same error as screenshot 2 above,

Dec 17, 2012 at 10:32 PM

It should work as long as you have all the assemblies in the C:\Users\xxxxxxx\Desktop\SysloggerTest\Logging\bin directory and that the configuration has the correct type information.  So the C:\Users\xxxxxxx\Desktop\SysloggerTest\Logging\bin should have the following assemblies:

Microsoft.Practices.EnterpriseLibrary.Common.dll
Microsoft.Practices.EnterpriseLibrary.Logging.dll
Microsoft.Practices.ServiceLocation.dll
Microsoft.Practices.Unity.Configuration.dll
Microsoft.Practices.Unity.dll
Microsoft.Practices.Unity.Interception.Configuration.dll
Microsoft.Practices.Unity.Interception.dll
Logging.dll

You can also take a look at the Sample Trace Listener project: Samples.TraceListeners.zip which is configured to use the configuration tool with the binaries path.

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