Enterprise Library 3.1

Topics: Enterprise Library Core, Logging Application Block
Jun 12, 2007 at 6:54 PM
Hi:

Has anybody experienced the following issue with the EntLib 3.1 configuration tool? :

I implemented my own Formatter class extending Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.LogFormatter abstract class, when I try to load the assembly including my formatter class to set it as a Custom Formatter into the EntLib library tool I get the following error message:

There were no types found in the assembly "Util" that implement or inherit from the base type: "Microsoft.Practices.EnterpriseLibrary.Logging.Formatters.LogFormatter"

Notes:

- I already tried to make an strong named assembly.

- I already build and tested the formatter class.

- VS integrated configuration tool does not load correctly the app.config file that I started from scratch with the configuration tool located at : D:\Program Files\Microsoft Enterprise Library 3.1 - May 2007\Bin, It only shows the applciation structure.

Regards
Luis
Jun 13, 2007 at 3:55 PM
That error is a bit misleading.

The Configuration Tool is often looking for an attribute on your classes. If it doesn't find one it barks at you with such an error.

You probably need the attribute

[ConfigurationElementType(typeof(...))]

on your Formatter Class, where ... is the name of your data class.

For example, if you look at the TextFormatter Class, it has the following attribute:

[ConfigurationElementType(typeof(TextFormatterData))]

Regards,

Dave

___________________________________

David Hayden
Microsoft MVP C#
Jun 13, 2007 at 8:01 PM
I already included that attribute but the configuration tool still shows the same error message.

Thanks David
Jun 13, 2007 at 8:13 PM
Help with Ent Lib config for Logging.
I am attempting to turn off logging for a listener and I am not sure where to set that.
when I set enabled="false" below, entire logging is turned off.

<add name="LogEnabled Filter"
type="Microsoft.Practices.EnterpriseLibrary.Logging.Filters.LogEnabledFilter, Microsoft.Practices.EnterpriseLibrary.Logging"
enabled="true"
/>

I only wish to turn off logging for say at this level:
<add
name="Trace"
switchValue="All">
<listeners>
<add name="Flat File Destination" />
</listeners>
</add>

or at this level:
<add name="Flat File Destination"
type="Microsoft.Practices.EnterpriseLibrary.Logging.TraceListeners.FlatFileTraceListener, Microsoft.Practices.EnterpriseLibrary.Logging"
listenerDataType="Microsoft.Practices.EnterpriseLibrary.Logging.Configuration.FlatFileTraceListenerData, Microsoft.Practices.EnterpriseLibrary.Logging"
fileName ="trace.log"
header="----------------header------------------------"
footer="----------------footer------------------------"
formatter="Text Formatter"
/>

Any help is appreciated.