Click here to Skip to main content
15,886,919 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
hi guys,

I have an application(myApp.exe) that has a config file(App.config).
Inside "App.config" is a line similar below:

HTML
<appsettings>
     <add key="ConfigPath" value="LoggingBlock.config" />
</appsettings>


"LoggingBlock.config" will contain the log settings of "myApp.exe".
How do I let "myApp.exe" refer to "LoggingBlock.config" when logging is needed if the config file mainly used by "myApp.exe" is "App.config"? Is it possible?

Ive searched the net but none seem to have the same issue as mine. :(

Any kind of help is much appreciated.

Thanks. :)
Posted
Updated 13-Nov-11 18:37pm
v2
Comments
karylle 14-Nov-11 0:53am    
I just read that Application Blocks can only be contained in "App.config". :( Still looking for ways to have it in another file not used by the application by default.

I changed the content of App.config. It now contains :

HTML
<enterpriselibrary.configurationsource selectedsource="File-based Configuration Source">
     <sources>
          <add name="File-based Configuration Source" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.FileConfigurationSource, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.414.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
          filePath="C:\LoggingBlock.config" />
      </add></sources>
</enterpriselibrary.configurationsource>


Nothing was changed in the application. :)
 
Share this answer
 
Comments
RaviRanjanKr 15-Nov-11 8:20am    
My 5+
 
Share this answer
 
Comments
karylle 13-Nov-11 22:28pm    
Thanks for the quick reply. Will take a look at the utility.
karylle 14-Nov-11 0:32am    
Nice tool but it's not exactly what I was looking for.

Assuming "LoggingBlock.config" is generated by Enterprise library, can i refer to it when logging? The applications I've tried before only had "App.config" which is the only config file used in the entire application. In my situation now, "App.config" will contain the filename of the config file generated by Enterprise Library.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900