Can we add External Config for loggingConfiguration ?

Topics: Logging Application Block
Sep 11, 2009 at 12:13 PM

Hi,

Can we add external configuration file for loggingConfiguration in web.config?

like for appsettings ,we can add as <appSettings file="test.config"> and in test.config we can specify the key/value pairs.

 

Thanks,

Madhu.

Sep 11, 2009 at 12:28 PM

Hi,

Please see this link: http://blogs.msdn.com/tomholl/archive/2006/04/02/entlib2externalconfig.aspx

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Sep 11, 2009 at 1:41 PM

Thanks alot Valiant,

provided link is very helpful for me .

 

 

 

 

Sep 24, 2009 at 9:31 PM
AvanadeSupport wrote:

Hi,

Please see this link: http://blogs.msdn.com/tomholl/archive/2006/04/02/entlib2externalconfig.aspx

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

hi,

according to your answer: as far as i know it's not possible to refer to an external file that isn't located in the local path, is that right?i read it in a book and i tried it by myself.

so <loggingConfiguration configSource="Logging.config" /> works fine, but <loggingConfiguration configSource="c:\anywhereelse\Logging.config" /> won't work. is the only possibility to handle this problem to create a new logger like this:

Dim lLoggerSource As New LogWriterFactory(New FileConfigurationSource("W:\config\ConfigTest\Test\Logging.config"))
Dim lNewLogger = lLoggerSource.Create
lNewLogger.Write(New LogEntry("worked!", "Critical", 0, 0, TraceEventType.Error, "Title: New Logger Test", Nothing))

i tried it and it worked.

 

Sep 25, 2009 at 3:29 AM

Yes, if you use the configSource attribute.  But if you use the Configuration Sources of Entlib, it is possible to use absolute paths and thus refer to files that is not located on the local path.  It's also discussed in Tom Hollander's blog.

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Sep 25, 2009 at 10:47 AM

AvanadeSupport wrote:

Yes, if you use the configSource attribute.  But if you use the Configuration Sources of Entlib, it is possible to use absolute paths and thus refer to files that is not located on the local path.  It's also discussed in Tom Hollander's blog.

 

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

hi,

i read that part. i think you talked about this:

To do this, you need to add a Configuration Sources node to your application’s configuration using the Enterprise Library Configuration tool. From there you can add a File Configuration Source node and set the filename you wish to use. Finally, while you can configure as many Configuration Sources as you want using the tool, only one is ‘selected’ to be the one which Enterprise Library will automatically use if you don’t do anything special. Use the SelectedSource property under the Configuration Sources node to select which source you wish to use automatically (i.e. the FileConfigurationSource for this example).

i'm using entlib 4.1 and i cannot find the option "File Configuration Source".

Sep 25, 2009 at 11:16 AM

What do you see then when you right click on the Configuration Sources node?

Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com