Multiple Config Files

Topics: Logging Application Block
Jul 16, 2014 at 4:57 AM
how to Select Entlib.config file at runtime i.e when logger.write method called.
my solution currently using app.config file.

plz help its urgent....
Jul 17, 2014 at 6:19 AM
You would typically bootstrap the configuration at application startup. You could defer until logging is required but bootstrapping would have to be done before Logger.Write is invoked. You could use a Lazy<LogWriter> or some sort of facade that performs the bootstrapping before logging.

To bootstrap the blocks you could use a FileConfigurationSource to load the Entlib.config file:
FileConfigurationSource configSource = new FileConfigurationSource("Entlib.config");
LogWriterFactory logWriterFactory = new LogWriterFactory(configSource);
Randy Levy
Enterprise Library support engineer
Support How-to
Jul 18, 2014 at 10:06 AM
thank you Randy..