Welcome! and rules
Joel on Software
Reload app.config file without restarting app
Is there any way to reload the settings from an app config file without restarting the application? My app is a C# windows service, and I have implemented logging according to a level set in my app.config file. Normally the service just logs errors and warnings, but a setting in the app.config can be changed to tell the service to log debug and info messages as well. I don't have enough disk space to log all debug and info messages all the time.
No, you're not missing anything. The default configuration system is indeed read once, cache forever, which is why you can't change the file.
Brad Wilson [MSFT]
Log4Net has a "WatchConfigFile" option and is much simpler to configure and use than Enterprise Library.
Thanks for the suggestions guys. Due to the size of our code base and the fact that only one setting needs to be changed on the fly, I have left most config settings alone, and just changed the logging component so that it reads the setting from the same config file, then starts a FileSystemWatcher to re-read the setting if the config file changes.
Fog Creek Home