Retrieving Logging data from External Configuration

Topics: Building and extending application blocks, Logging Application Block
Nov 5, 2010 at 2:53 AM


I am in the process of attempting to determine the best manner of feeding my client application with its necessary EL 5.0 logging information (outside of using the standard app.config file). From details on the web (see Scenario 2: Using a Non-default Configuration Store), I have read versions proir to EL ver 5 could support this through a sample "SQL Configuration source"... this I have learnt is not presently available for EL 5 (reference here) but maybe only end of Nov.

My plan was to persist the XML logging config into a text field within the database, on application load, retrieve this info and update the logging config via custom configuration source.

Other option would be to use the Configuration API or newly available fluent API, build the logging config at runtime, based on instructions received from the database.

The custom configuration source appears more eloquent and cleaner though.

Are there any code samples available that could assist or point me in the right direction? The only direction I can find is a post related to creating a file-configuration-source


1. We are shackled to Oracle DB and not SQL.

2. Logging XML instructions where going to inserted into a text field within database, so no elaborate supporting data model.

I do realise that you guys are busy and are working on this, any pointers would be appreciated



Nov 5, 2010 at 4:34 AM

The code sample I could recommend is the existing code for the Sql Configuration Source in 4.1.  You could try converting the code to the 5.0 version yourself basing the structure of the classes from the related post you found on creating file configuration source.

Would you consider manually reading the configuration from the database and writing it to a .config file?  You would then create a FileConfigurationSource pointing to that config file and use it to create a LogWriterFactory instance:

IConfigurationSource configSource = new FileConfigurationSource("logging.config"); 
LogWriterFactory factory = new LogWriterFactory(configSource);
LogWriter logWriter = factory.Create();

Sarah Urmeneta
Global Technologies and Solutions
Avanade, Inc.

Nov 5, 2010 at 7:48 PM

Thanks Sarah for the quick response...

I will look into the Sql Configuration Source in 4.1...

thanks for the info..



Nov 5, 2010 at 7:58 PM

We've got the 5.0 version in test right now, hopefully it'll be out in a couple of weeks after we go through the test/fix/doc/package/release cycle.


Nov 5, 2010 at 7:59 PM

thanks for the update, appreciate it :)

Jan 3, 2011 at 8:36 PM


The SQL Configuration Source for Enterprise Library source for ver 5.0 can be found here .